Browse Source

code cleanup #9

master
Petr Balashov 8 years ago
parent
commit
3bcc5a788c
  1. 462
      assets/scripts/kmd_wallet_dashboard.js
  2. 476
      assets/scripts/login.js
  3. 211
      assets/scripts/sidebar.js
  4. 35
      assets/scripts/walletsettings.js

462
assets/scripts/kmd_wallet_dashboard.js

@ -913,50 +913,49 @@ function KMDGetProtectedTransactions() {
get_zaddr_list = KMDListaddrZ();
$.each(get_zaddr_list, function(index, value) {
//console.log(value.addr);
var ajax_data_to_hex = '["'+ value.addr +'",0]'
var tmpzaddr_hex_input = Iguana_HashHex(ajax_data_to_hex)
//console.log(tmpzaddr_hex_input);
var ajax_data_to_hex = '["' + value.addr + '",0]',
tmpzaddr_hex_input = Iguana_HashHex(ajax_data_to_hex),
passthru_agent = getPassthruAgent(),
tmpIguanaRPCAuth = 'tmpIgRPCUser@ '+ sessionStorage.getItem('IguanaRPCAuth'),
ajax_data = {
'userpass': tmpIguanaRPCAuth,
"agent": passthru_agent,
"method": "passthru",
"function": "z_listreceivedbyaddress",
"hex": tmpzaddr_hex_input
};
var passthru_agent = getPassthruAgent();
var tmpIguanaRPCAuth = 'tmpIgRPCUser@'+sessionStorage.getItem('IguanaRPCAuth');
var ajax_data = {'userpass':tmpIguanaRPCAuth,"agent":passthru_agent,"method":"passthru","function":"z_listreceivedbyaddress","hex":tmpzaddr_hex_input}
//console.log(ajax_data);
$.ajax({
async: false,
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); //Ajax output gets the whole list of unspent coin with addresses
//console.log('== Data OutPut of z_listreceivedbyaddress ==');
//console.log(AjaxOutputData);
var AjaxOutputData = JSON.parse(data); // Ajax output gets the whole list of unspent coin with addresses
$.each(AjaxOutputData, function(index, txidvalue) {
console.log(txidvalue);
var tmp_category = '<i class="icon fa-arrow-circle-right"></i> IN';
var tmp_addr = value.addr.slice(0, 30)+'...';
if(!("amount" in txidvalue)) {
var tmp_addr = value.addr.slice(0, 30) + '...';
if (!('amount' in txidvalue)) {
var tmp_amount = 0;
} else {
var tmp_amount = txidvalue.amount;
}
var tmp_addr_txid_info = KMDGetTransactionIDInfo(AjaxOutputData[index].txid);
//console.log(tmp_addr_txid_info);
var tmp_confirmations = tmp_addr_txid_info[0].confirmations;
var tmp_secondsToString = secondsToString(tmp_addr_txid_info[0].time)
/*if(!("address" in AjaxOutputData[index])) {
tmp_addr = '<i class="icon fa-bullseye"></i> <span class="label label-dark">Z Address not listed by wallet!</span>'
}*/
tmplistZtransactions = ['<span class="label label-dark"><i class="icon fa-eye-slash"></i> private</span>',tmp_category,tmp_confirmations,tmp_amount,tmp_secondsToString,tmp_addr,'<button type="button" class="btn btn-xs white btn-info waves-effect waves-light" data-toggle="modal" data-target="#kmd_txid_info_mdl" id="kmd-txid-details-btn" data-txid-type="private" data-txid="'+txidvalue.txid+'"><i class="icon fa-search"></i></button>']
//console.log(tmplistZtransactions);
var tmp_addr_txid_info = KMDGetTransactionIDInfo(AjaxOutputData[index].txid),
tmp_confirmations = tmp_addr_txid_info[0].confirmations,
tmp_secondsToString = secondsToString(tmp_addr_txid_info[0].time),
tmplistZtransactions = [
'<span class="label label-dark">' +
'<i class="icon fa-eye-slash"></i> private' +
'</span>',
tmp_category,
tmp_confirmations,
tmp_amount,
tmp_secondsToString,
tmp_addr,
'<button type="button" class="btn btn-xs white btn-info waves-effect waves-light" data-toggle="modal" data-target="#kmd_txid_info_mdl" id="kmd-txid-details-btn" data-txid-type="private" data-txid="' + txidvalue.txid + '"><i class="icon fa-search"></i></button>'
];
result.push(tmplistZtransactions);
});
},
@ -971,7 +970,7 @@ function KMDGetProtectedTransactions() {
}
});
});
//console.log(result);
NProgress.done();
return result;
}
@ -979,25 +978,40 @@ function KMDGetProtectedTransactions() {
function KMDfillTxHistoryT() {
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();
var txhistorydataT = KMDGetPublicTransactions();
//var txhistorydataZ = KMDGetProtectedTransactions();
//var txhistorydata = $.merge( txhistorydataT, txhistorydataZ );
var txhistorydata = txhistorydataT;
//console.log(txhistorydata);
var kmd_txhistory_table = '';
kmd_txhistory_table = $('#kmd-tx-history-tbl').DataTable( { data: txhistorydata,
"order": [[ 4, "desc" ]],
var txhistorydata = txhistorydataT,
kmd_txhistory_table = '';
kmd_txhistory_table = $('#kmd-tx-history-tbl').DataTable({
data: txhistorydata,
'order': [
[
4,
'desc'
]
],
select: true,
retrieve: true
});
kmd_txhistory_table.destroy();
kmd_txhistory_table = $('#kmd-tx-history-tbl').DataTable( { data: txhistorydata,
"order": [[ 4, "desc" ]],
kmd_txhistory_table = $('#kmd-tx-history-tbl').DataTable({
data: txhistorydata,
'order': [
[
4,
'desc'
]
],
select: true,
retrieve: true
});
@ -1005,43 +1019,47 @@ function KMDfillTxHistoryT() {
NProgress.done();
}
function KMDListAddresses(pubpriv) {
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();
var result = [];
var ajax_data_to_hex = '""'
var ajax_function_input = '';
var tmplistaddr_hex_input = '';
var result = [],
ajax_data_to_hex = '""',
ajax_function_input = '',
tmplistaddr_hex_input = '';
if ( pubpriv === 'public' ) {
ajax_function_input = 'getaddressesbyaccount';
tmplistaddr_hex_input = Iguana_HashHex(ajax_data_to_hex)
tmplistaddr_hex_input = Iguana_HashHex(ajax_data_to_hex);
}
if ( pubpriv === 'private' ) {
ajax_function_input = 'z_listaddresses';
tmplistaddr_hex_input = "";
tmplistaddr_hex_input = '';
}
//console.log(tmpzaddr_hex_input);
var passthru_agent = getPassthruAgent(),
tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
ajax_data = {
'userpass': tmpIguanaRPCAuth,
'agent': passthru_agent,
'method': 'passthru',
'function': ajax_function_input,
'hex': tmplistaddr_hex_input
};
var passthru_agent = getPassthruAgent();
var tmpIguanaRPCAuth = 'tmpIgRPCUser@'+sessionStorage.getItem('IguanaRPCAuth');
var ajax_data = {'userpass':tmpIguanaRPCAuth,"agent":passthru_agent,"method":"passthru","function":ajax_function_input,"hex":tmplistaddr_hex_input}
//console.log(ajax_data);
$.ajax({
async: false,
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); //Ajax output gets the whole list of unspent coin with addresses
//console.log('== Data OutPut of getaddressesbyaccount ==');
//console.log(AjaxOutputData);
var AjaxOutputData = JSON.parse(data); // Ajax output gets the whole list of unspent coin with addresses
result = AjaxOutputData;
},
error: function(xhr, textStatus, error) {
@ -1054,7 +1072,7 @@ function KMDListAddresses(pubpriv) {
console.log(error);
}
});
//console.log(result);
NProgress.done();
return result;
}
@ -1063,12 +1081,16 @@ function KMDListAddresses(pubpriv) {
function KMDGetNewAddresses(pubpriv) {
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();
var result = [];
var ajax_function_input = '';
var result = [],
ajax_function_input = '';
if ( pubpriv === 'public' ) {
ajax_function_input = 'getnewaddress';
}
@ -1076,21 +1098,24 @@ function KMDGetNewAddresses(pubpriv) {
ajax_function_input = 'z_getnewaddress';
}
var passthru_agent = getPassthruAgent();
var tmpIguanaRPCAuth = 'tmpIgRPCUser@'+sessionStorage.getItem('IguanaRPCAuth');
var ajax_data = {'userpass':tmpIguanaRPCAuth,"agent":passthru_agent,"method":"passthru","function":ajax_function_input,"hex":""}
//console.log(ajax_data);
var passthru_agent = getPassthruAgent(),
tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
ajax_data = {
'userpass': tmpIguanaRPCAuth,
'agent': passthru_agent,
'method': 'passthru',
'function': ajax_function_input,
'hex': ''
};
$.ajax({
async: false,
type: 'POST',
data: JSON.stringify(ajax_data),
url: 'http://127.0.0.1:7778',
//dataType: 'text',
success: function(data, textStatus, jqXHR) {
//console.log('== Data OutPut of get new address ==');
//console.log(data);
result = data;
toastr.success("New address generated successfully", "Wallet Notification");
toastr.success('New address generated successfully', 'Wallet Notification');
},
error: function(xhr, textStatus, error) {
console.log('failed getting Coin History.');
@ -1102,42 +1127,51 @@ function KMDGetNewAddresses(pubpriv) {
console.log(error);
}
});
//console.log(result);
NProgress.done();
return result;
}
function KMDListAllAddr() {
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 only_reciving_addr_data = [];
var listTaddr = KMDListAddresses('public');
var listZaddr = KMDListAddresses('private');
var listAlladdr = $.merge( listTaddr, listZaddr );
//console.log(listAlladdr[5].slice(0, 2));
var only_reciving_addr_data = [],
listTaddr = KMDListAddresses('public'),
listZaddr = KMDListAddresses('private'),
listAlladdr = $.merge( listTaddr, listZaddr );
$.each(listAlladdr, function(index, value) {
tmp_addr_label = '<span class="label label-default"><i class="icon fa-eye"></i> public</span>';
if ( listAlladdr[index].slice(0, 2) == 'zc' || listAlladdr[index].slice(0, 2) == 'zt' ) { tmp_addr_label = '<span class="label label-dark"><i class="icon fa-eye-slash"></i> private</span>'; }
tmp_addr_label = '<span class="label label-default">' +
'<i class="icon fa-eye"></i> public' +
'</span>';
if ( listAlladdr[index].slice(0, 2) == 'zc' || listAlladdr[index].slice(0, 2) == 'zt' ) {
tmp_addr_label = '<span class="label label-dark">' +
'<i class="icon fa-eye-slash"></i> private' +
'</span>';
}
//var tmp_addr_action_button = '<button></button>';
only_reciving_addr_data.push([tmp_addr_label, listAlladdr[index]]);
only_reciving_addr_data.push([
tmp_addr_label,
listAlladdr[index]
]);
});
//console.log(only_reciving_addr_data);
var kmd_recieve_table = '';
kmd_recieve_table = $('#kmd-recieve-addr-tbl').DataTable( { data: only_reciving_addr_data,
kmd_recieve_table = $('#kmd-recieve-addr-tbl').DataTable({
data: only_reciving_addr_data,
select: false,
retrieve: true
});
kmd_recieve_table.destroy();
kmd_recieve_table = $('#kmd-recieve-addr-tbl').DataTable( { data: only_reciving_addr_data,
kmd_recieve_table = $('#kmd-recieve-addr-tbl').DataTable({
data: only_reciving_addr_data,
select: false,
retrieve: true
});
@ -1147,27 +1181,26 @@ function KMDListAllAddr() {
}
function KMDGetTransactionIDInfo(txid) {
var result = [];
var ajax_data_to_hex = '["'+ txid +'"]'
var tmptxid_output = Iguana_HashHex(ajax_data_to_hex)
//console.log(tmptxid_output);
var result = [],
ajax_data_to_hex = '["' + txid + '"]',
tmptxid_output = Iguana_HashHex(ajax_data_to_hex),
passthru_agent = getPassthruAgent(),
tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
ajax_data_txid_input = {
'userpass': tmpIguanaRPCAuth,
'agent': passthru_agent,
'method': 'passthru',
'function': 'gettransaction',
'hex': tmptxid_output
};
var passthru_agent = getPassthruAgent();
var tmpIguanaRPCAuth = 'tmpIgRPCUser@'+sessionStorage.getItem('IguanaRPCAuth');
var ajax_data_txid_input = {'userpass':tmpIguanaRPCAuth,"agent":passthru_agent,"method":"passthru","function":"gettransaction","hex":tmptxid_output}
//console.log(ajax_data_txid_input);
$.ajax({
async: false,
type: 'POST',
data: JSON.stringify(ajax_data_txid_input),
url: 'http://127.0.0.1:7778',
//dataType: 'text',
success: function(data, textStatus, jqXHR) {
var AjaxOutputData = JSON.parse(data);
//console.log('== Data OutPut of z_getbalance ==');
//console.log(value);
//console.log(AjaxOutputData);
result.push(AjaxOutputData);
},
error: function(xhr, textStatus, error) {
@ -1180,38 +1213,38 @@ function KMDGetTransactionIDInfo(txid) {
console.log(error);
}
});
//console.log(result);
return result;
}
function KMDGetOPIDInfo(opid) {
var result = [];
var tmpopid_output = '';
var result = [],
tmpopid_output = '';
if ( opid === undefined ) {
tmpopid_output = '';
} else {
var ajax_data_to_hex = '["'+ opid +'"]'
var tmpopid_output = Iguana_HashHex(ajax_data_to_hex)
//console.log(tmpopid_output);
var ajax_data_to_hex = '["' + opid + '"]',
tmpopid_output = Iguana_HashHex(ajax_data_to_hex);
}
var passthru_agent = getPassthruAgent();
var tmpIguanaRPCAuth = 'tmpIgRPCUser@'+sessionStorage.getItem('IguanaRPCAuth');
var ajax_data_txid_input = {'userpass':tmpIguanaRPCAuth,"agent":passthru_agent,"method":"passthru","function":"z_getoperationstatus","hex":tmpopid_output}
//console.log(ajax_data_txid_input);
var passthru_agent = getPassthruAgent(),
tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
ajax_data_txid_input = {
'userpass': tmpIguanaRPCAuth,
'agent': passthru_agent,
'method': 'passthru',
'function': 'z_getoperationstatus',
'hex': tmpopid_output
};
$.ajax({
async: false,
type: 'POST',
data: JSON.stringify(ajax_data_txid_input),
url: 'http://127.0.0.1:7778',
//dataType: 'text',
success: function(data, textStatus, jqXHR) {
var AjaxOutputData = JSON.parse(data);
//console.log('== Data OutPut of z_getoperationstatus ==');
//console.log(value);
//console.log(AjaxOutputData);
result.push(AjaxOutputData);
},
error: function(xhr, textStatus, error) {
@ -1224,103 +1257,120 @@ function KMDGetOPIDInfo(opid) {
console.log(error);
}
});
//console.log(result);
return result;
}
function KMDListAllOPIDs() {
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();
var opids_statuses_data = [];
var listOPIDs = KMDGetOPIDInfo();
var tmp_results = 'Waiting...';
var tmp_status_label = '';
var tmp_creation_time = '';
var tmp_id = '';
var opids_statuses_data = [],
listOPIDs = KMDGetOPIDInfo(),
tmp_results = 'Waiting...',
tmp_status_label = '',
tmp_creation_time = '',
tmp_id = '';
console.log(listOPIDs);
$.each(listOPIDs[0], function(index, value) {
tmp_id = listOPIDs[0][index].id;
tmp_creation_time = secondsToString(listOPIDs[0][index].creation_time);
if (listOPIDs[0][index].status === 'queued') {
tmp_status_label = '<span class="label label-warning"><i class="icon fa-eye"></i> Queued</span>';
tmp_status_label = '<span class="label label-warning">' +
'<i class="icon fa-eye"></i> Queued' +
'</span>';
tmp_results = '<i>Please press refresh button in a minute or so to see updated status...</i>';
}
if (listOPIDs[0][index].status === 'executing') {
tmp_status_label = '<span class="label label-info"><i class="icon fa-eye"></i> Executing</span>';
tmp_status_label = '<span class="label label-info">' +
'<i class="icon fa-eye"></i> Executing' +
'</span>';
tmp_results = '<i>Please press refresh button in a minute or so to see updated status...</i>';
}
if (listOPIDs[0][index].status === 'failed') {
tmp_status_label = '<span class="label label-danger"><i class="icon fa-eye"></i> Failed</span>';
tmp_results = '<b>Error Code:</b> '+listOPIDs[0][index].error.code+'<br> <b>Message:</b> '+listOPIDs[0][index].error.message;
tmp_status_label = '<span class="label label-danger">' +
'<i class="icon fa-eye"></i> Failed' +
'</span>';
tmp_results = '<b>Error Code:</b> ' + listOPIDs[0][index].error.code + '<br> <b>Message:</b> ' + listOPIDs[0][index].error.message;
}
if (listOPIDs[0][index].status === 'success') {
tmp_status_label = '<span class="label label-success"><i class="icon fa-eye"></i> Success</span>';
tmp_results = '<b>txid:</b> '+listOPIDs[0][index].result.txid+'<br> <b>Execution Seconds:</b> '+listOPIDs[0][index].execution_secs;
}
//console.log(tmp_status_label);
//console.log(tmp_id);
//console.log(tmp_creation_time);
//console.log(tmp_results);
opids_statuses_data.push([tmp_status_label, tmp_id, tmp_creation_time, tmp_results]);
tmp_status_label = '<span class="label label-success">' +
'<i class="icon fa-eye"></i> Success' +
'</span>';
tmp_results = '<b>txid:</b> ' + listOPIDs[0][index].result.txid + '<br> <b>Execution Seconds:</b> ' + listOPIDs[0][index].execution_secs;
}
opids_statuses_data.push([
tmp_status_label,
tmp_id,
tmp_creation_time,
tmp_results
]);
});
//console.log(opids_statuses_data);
var kmd_opids_statuses_table = '';
kmd_opids_statuses_table = $('#kmd-opid-status-tbl').DataTable( { data: opids_statuses_data,
"order": [[ 2, "desc" ]],
kmd_opids_statuses_table = $('#kmd-opid-status-tbl').DataTable({
data: opids_statuses_data,
'order': [
[
2,
'desc'
]
],
select: false,
retrieve: true
});
kmd_opids_statuses_table.destroy();
kmd_opids_statuses_table = $('#kmd-opid-status-tbl').DataTable( { data: opids_statuses_data,
"order": [[ 2, "desc" ]],
kmd_opids_statuses_table = $('#kmd-opid-status-tbl').DataTable({
data: opids_statuses_data,
'order': [
[
2,
'desc'
]
],
select: false,
retrieve: true
});
NProgress.done();
return opids_statuses_data;
}
function KMDZSendManyTransaction() {
var result = [];
var zsendmoney_output = '';
var tmp_zsendmany_from_addr = $('#kmd_wallet_send_from').val();
var tmp_zsendmany_to_addr = $('#kmd_wallet_sendto').val();
var tmp_zsendmany_total_amount = $('#kmd_wallet_total_value').text();
//console.log(tmp_zsendmany_from_addr);
//console.log(tmp_zsendmany_to_addr);
//console.log(tmp_zsendmany_total_amount);
var ajax_data_to_hex = '["'+tmp_zsendmany_from_addr+'",[{"address":"'+tmp_zsendmany_to_addr+'","amount":'+tmp_zsendmany_total_amount+'}]]'
var zsendmoney_output = Iguana_HashHex(ajax_data_to_hex)
//console.log(zsendmoney_output);
var result = [],
zsendmoney_output = '',
tmp_zsendmany_from_addr = $('#kmd_wallet_send_from').val(),
tmp_zsendmany_to_addr = $('#kmd_wallet_sendto').val(),
tmp_zsendmany_total_amount = $('#kmd_wallet_total_value').text(),
ajax_data_to_hex = '["' + tmp_zsendmany_from_addr + '",[{"address":"' + tmp_zsendmany_to_addr + '","amount":' + tmp_zsendmany_total_amount + '}]]',
zsendmoney_output = Iguana_HashHex(ajax_data_to_hex),
passthru_agent = getPassthruAgent(),
tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
ajax_data_txid_input = {
'userpass': tmpIguanaRPCAuth,
'agent': passthru_agent,
'method': 'passthru',
'function': 'z_sendmany',
'hex': zsendmoney_output
};
var passthru_agent = getPassthruAgent();
var tmpIguanaRPCAuth = 'tmpIgRPCUser@'+sessionStorage.getItem('IguanaRPCAuth');
var ajax_data_txid_input = {'userpass':tmpIguanaRPCAuth,"agent":passthru_agent,"method":"passthru","function":"z_sendmany","hex":zsendmoney_output}
//console.log(ajax_data_txid_input);
$.ajax({
async: false,
type: 'POST',
data: JSON.stringify(ajax_data_txid_input),
url: 'http://127.0.0.1:7778',
//dataType: 'text',
success: function(data, textStatus, jqXHR) {
console.log('== Data OutPut of z_sendmany ==');
console.log(data);
@ -1336,7 +1386,7 @@ function KMDZSendManyTransaction() {
console.log(error);
}
});
//console.log(result);
KMDListAllOPIDs();
return result;
}
@ -1348,29 +1398,32 @@ function clearSendManyFieldData() {
$('#kmd_wallet_amount').val('');
}
function CheckIfConnected() {
var result = [];
var extcoin = $('[data-extcoin]').attr("data-extcoin");
var result = [],
extcoin = $('[data-extcoin]').attr('data-extcoin'),
passthru_agent = getPassthruAgent(),
tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
ajax_data = {
'userpass': tmpIguanaRPCAuth,
'agent': passthru_agent,
'method': 'passthru',
'function': 'getinfo',
'hex': ''
};
var passthru_agent = getPassthruAgent();
var tmpIguanaRPCAuth = 'tmpIgRPCUser@'+sessionStorage.getItem('IguanaRPCAuth');
var ajax_data = {'userpass':tmpIguanaRPCAuth,"agent":passthru_agent,"method":"passthru","function":"getinfo","hex":""}
console.log(ajax_data);
$.ajax({
async: false,
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 ==');
console.log(AjaxOutputData);
console.log(AjaxOutputData.error);
//console.log(AjaxOutputData['error'].message);
if ( AjaxOutputData.errors != undefined ) {
//console.log('connected');
result.push('connected');
} else if ( AjaxOutputData['error'].message = 'Activating best chain...' ) {
result.push('activating');
@ -1379,7 +1432,6 @@ function CheckIfConnected() {
} else {
result.push(AjaxOutputData.errors);
}
},
error: function(xhr, textStatus, error) {
console.log('failed getting Coin History.');
@ -1391,33 +1443,38 @@ function CheckIfConnected() {
console.log(error);
}
});
return result;
}
function CheckIfWalletEncrypted() {
var result = [];
var result = [],
passthru_agent = getPassthruAgent(),
tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
ajax_data = {
'userpass': tmpIguanaRPCAuth,
'agent': passthru_agent,
'method': 'passthru',
'function': 'walletlock',
'hex': ''
};
var passthru_agent = getPassthruAgent();
var tmpIguanaRPCAuth = 'tmpIgRPCUser@'+sessionStorage.getItem('IguanaRPCAuth');
var ajax_data = {'userpass':tmpIguanaRPCAuth,"agent":passthru_agent,"method":"passthru","function":"walletlock","hex":""}
console.log(ajax_data);
$.ajax({
async: false,
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 ==');
console.log(AjaxOutputData.error);
if ( AjaxOutputData.errors != undefined ) {
//console.log('encrypted');
result.push('encrypted');
} else {
result.push(AjaxOutputData.error);
}
},
error: function(xhr, textStatus, error) {
console.log('failed getting Coin History.');
@ -1429,29 +1486,32 @@ function CheckIfWalletEncrypted() {
console.log(error);
}
});
return result;
}
function KMD_getInfo_rtrn() {
var result = [];
var extcoin = $('[data-extcoin]').attr("data-extcoin");
var result = [],
extcoin = $('[data-extcoin]').attr('data-extcoin'),
passthru_agent = getPassthruAgent(),
tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
ajax_data = {
'userpass': tmpIguanaRPCAuth,
'agent': passthru_agent,
'method': 'passthru',
'function': 'getinfo',
'hex': ''
};
var passthru_agent = getPassthruAgent();
var tmpIguanaRPCAuth = 'tmpIgRPCUser@'+sessionStorage.getItem('IguanaRPCAuth');
var ajax_data = {'userpass':tmpIguanaRPCAuth,"agent":passthru_agent,"method":"passthru","function":"getinfo","hex":""}
//console.log(ajax_data);
$.ajax({
async: false,
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 ==');
//console.log(AjaxOutputData);
if ( AjaxOutputData.errors != undefined ) {
//console.log('connected');
result.push(AjaxOutputData);
} else if ( AjaxOutputData['error'].message = 'Activating best chain...' ) {
result.push('activating');
@ -1460,7 +1520,6 @@ function KMD_getInfo_rtrn() {
} else {
result.push(AjaxOutputData.errors);
}
},
error: function(xhr, textStatus, error) {
console.log('failed getting Coin History.');
@ -1472,29 +1531,24 @@ function KMD_getInfo_rtrn() {
console.log(error);
}
});
return result[0];
}
function KMD_ProgressBar() {
var result = [];
var extcoin = $('[data-extcoin]').attr("data-extcoin");
var result = [],
extcoin = $('[data-extcoin]').attr('data-extcoin'),
getinfotmp = KMD_getInfo_rtrn();
var getinfotmp = KMD_getInfo_rtrn()
//console.log(getinfotmp);
//console.log(getinfotmp.blocks);
//console.log(getinfotmp.connections);
//console.log(getinfotmp.longestchain);
if ( getinfotmp == 'activating') {
$('span[data-extcoin="'+extcoin+'"][id="extcoin-sync-percent"]').text('Activating...');
$('span[data-extcoin="' + extcoin + '"][id="extcoin-sync-percent"]').text('Activating...');
} else {
var sync_percent = parseFloat(parseInt(getinfotmp.blocks, 10) * 100)/ parseInt(getinfotmp.longestchain, 10);
//console.log(parseFloat(sync_percent).toFixed(2)+'%')
$('div[data-extcoin="'+extcoin+'"][id="extcoin-sync"]').width(parseFloat(sync_percent).toFixed(2)+'%');
$('span[data-extcoin="'+extcoin+'"][id="extcoin-sync-percent"]').text(parseFloat(sync_percent).toFixed(2)+'%');
$('span[data-extcoin="'+extcoin+'"][id="extcoin-synced-blocks"]').text(getinfotmp.blocks);
$('span[data-extcoin="'+extcoin+'"][id="extcoin-longestchain"]').text(getinfotmp.longestchain);
$('span[data-extcoin="'+extcoin+'"][id="extcoin-connections"]').text(getinfotmp.connections);
var sync_percent = parseFloat(parseInt(getinfotmp.blocks, 10) * 100) / parseInt(getinfotmp.longestchain, 10);
$('div[data-extcoin="' + extcoin + '"][id="extcoin-sync"]').width(parseFloat(sync_percent).toFixed(2) + '%');
$('span[data-extcoin="' + extcoin + '"][id="extcoin-sync-percent"]').text(parseFloat(sync_percent).toFixed(2) + '%');
$('span[data-extcoin="' + extcoin + '"][id="extcoin-synced-blocks"]').text(getinfotmp.blocks);
$('span[data-extcoin="' + extcoin + '"][id="extcoin-longestchain"]').text(getinfotmp.longestchain);
$('span[data-extcoin="' + extcoin + '"][id="extcoin-connections"]').text(getinfotmp.connections);
}
}

476
assets/scripts/login.js

@ -1,26 +1,23 @@
var Login = function() {
toastr.options = {
"closeButton": true,
"debug": false,
"positionClass": "toast-top-right",
"showDuration": "5000",
"hideDuration": "1000",
"timeOut": "5000",
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut"
'closeButton': true,
'debug': false,
'positionClass': 'toast-top-right',
'showDuration': '5000',
'hideDuration': '1000',
'timeOut': '5000',
'extendedTimeOut': '1000',
'showEasing': 'swing',
'hideEasing': 'linear',
'showMethod': 'fadeIn',
'hideMethod': 'fadeOut'
}
var handleLogin = function() {
$('.login-form').validate({
//errorElement: 'span', //default input error message container
//errorClass: 'help-block', // default input error message class
//focusInvalid: false, // do not focus the last invalid input
// errorElement: 'span', //default input error message container
// errorClass: 'help-block', // default input error message class
// focusInvalid: false, // do not focus the last invalid input
rules: {
password: {
required: true
@ -29,11 +26,11 @@ var Login = function() {
messages: {
password: {
required: "Password is required."
required: 'Password is required.'
}
},
invalidHandler: function(event, validator) { //display error alert on form submit
invalidHandler: function(event, validator) { // display error alert on form submit
$('.alert-danger', $('.login-form')).show();
},
@ -52,87 +49,77 @@ var Login = function() {
},
submitHandler: function(form) {
var tmpIguanaRPCAuth = 'tmpIgRPCUser@'+sessionStorage.getItem('IguanaRPCAuth');
var ajax_data = {'userpass':tmpIguanaRPCAuth,'handle': $('#wallet-handle').val(),'password': $('#password').val(),'timeout': '2592000',"agent":"bitcoinrpc","method":"walletpassphrase"}
var tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
ajax_data = {
'userpass': tmpIguanaRPCAuth,
'handle': $('#wallet-handle').val(),
'password': $('#password').val(),
'timeout': '2592000',
'agent': 'bitcoinrpc',
'method': 'walletpassphrase'
};
$.ajax({
type: 'POST',
data: ajax_data,
data: JSON.stringify(ajax_data),
url: 'http://127.0.0.1:7778',
//url: 'http://127.0.0.1:7778/api/bitcoinrpc/walletpassphrase',
//dataType: 'JSON',
success: function(data, textStatus, jqXHR) {
var LoginOutput = JSON.parse(data);
var LoginDataToStore = JSON.stringify(data);
LoginDataToStore = JSON.stringify(data),
sessionStorage.setItem('IguanaActiveAccount', LoginDataToStore);
//console.log(sessionStorage);
//console.log('== Data OutPut ==');
//console.log(LoginOutput);
if (LoginOutput.result === 'success') {
console.log('Success');
//Iguana_DEXImportAll();
//swal("Success", "Login Successfully.", "success");
toastr.success("Login Successfull", "Account Notification")
//var logincoinnames = []; $('#logincoinslist input[type=checkbox]:checked').each(function() { logincoinnames.push(this.value); }); console.log(logincoinnames);
/*$.each(logincoinnames, function( index, value ) {
if ( value == 'BTC' ) {
var logincoinmodeval = $("input[name='logincoinbtcmode']:checked").val();
var logincoin_data = {"coin": value, "mode": logincoinmodeval};
Iguana_addcoinLogin(logincoin_data);
}
if ( value == 'BTCD' ) {
var logincoinmodeval = $("input[name='logincoinbtcdmode']:checked").val();
var logincoin_data = {"coin": value, "mode": logincoinmodeval};
Iguana_addcoinLogin(logincoin_data);
}
if ( value == 'KMD' ) {
var logincoinmodeval = $("input[name='logincoinkmdmode']:checked").val();
var logincoin_data = {"coin": value, "mode": logincoinmodeval};
Iguana_addcoinLogin(logincoin_data);
}
});*/
toastr.success('Login Successfull', 'Account Notification')
$('#password').val('')
$('#wallet-login').hide();
$('#wallet-core').fadeIn();
$('body').removeClass( "page-login layout-full page-dark" ).addClass( "" );
$('link[id=loginStyle]')[0].disabled=true;
//refreshEDEXCoinWalletList()
/*Shepherd_FetchBasiliskData().then(function(result){
console.log(result)
location.reload();
})*/
$('body').removeClass( 'page-login layout-full page-dark' ).addClass( '' );
$('link[id=loginStyle]')[0].disabled = true;
location.reload();
}
else {
} else {
// If something goes wrong, alert the error message that our service returned
//swal("Oops...", "Something went wrong!", "error");
if (LoginOutput.error === 'bitcoinrpc needs coin that is active') {
toastr.info("Seems like there's no coin running. Activating BTC.", "Coin Notification");
var logincoinnames = []; $('#logincoinslist input[type=checkbox]:checked').each(function() { logincoinnames.push(this.value); }); console.log(logincoinnames);
toastr.info('Seems like there\'s no coin running. Activating BTC.', 'Coin Notification');
var logincoinnames = [];
$('#logincoinslist input[type=checkbox]:checked').each(function() { logincoinnames.push(this.value); });
console.log(logincoinnames);
$.each(logincoinnames, function( index, value ) {
if ( value == 'BTC' ) {
var logincoinmodeval = $("input[name='logincoinbtcmode']:checked").val();
var logincoin_data = {"coin": value, "mode": logincoinmodeval};
var logincoinmodeval = $('input[name="logincoinbtcmode"]:checked').val(),
logincoin_data = {
'coin': value,
'mode': logincoinmodeval
};
Iguana_addcoinLogin(logincoin_data);
}
if ( value == 'BTCD' ) {
var logincoinmodeval = $("input[name='logincoinbtcdmode']:checked").val();
var logincoin_data = {"coin": value, "mode": logincoinmodeval};
var logincoinmodeval = $('input[name="logincoinbtcdmode"]:checked').val(),
logincoin_data = {
'coin': value,
'mode': logincoinmodeval
};
Iguana_addcoinLogin(logincoin_data);
}
if ( value == 'KMD' ) {
var logincoinmodeval = $("input[name='logincoinkmdmode']:checked").val();
var logincoin_data = {"coin": value, "mode": logincoinmodeval};
var logincoinmodeval = $('input[name="logincoinkmdmode"]:checked').val(),
logincoin_data = {
'coin': value,
'mode': logincoinmodeval
};
Iguana_addcoinLogin(logincoin_data);
}
});
} else if ( LoginOutput.error === 'invalid passphrase' ) {
toastr.info("Invalid Passphrase. Make sure your passphrase is correct, or create new wallet.", "Login Notification");
toastr.info('Invalid Passphrase. Make sure your passphrase is correct, or create new wallet.', 'Login Notification');
} else {
toastr.warning("Opps... Something went wrong!", "Account Notification");
toastr.warning('Opps... Something went wrong!', 'Account Notification');
}
console.log(data.statusText);
console.log(textStatus);
console.log(jqXHR);
@ -146,26 +133,24 @@ var Login = function() {
}
console.log(textStatus);
console.log(error);
//swal("Oops...", "Something went wrong!", "error");
//toastr.warning("Opps... Something went wrong!", "Account Notification")
}
});
$('#section-dashboard').show();
$('#section-easydex').hide();
$('#section-about-iguana').hide();
$('#nav-dashboard').removeClass( "" ).addClass( "active open" );
$('#nav-easydex').removeClass( " active open" ).addClass( "" );
$('#nav-about-iguana').removeClass( " active open" ).addClass( "" );
//form.submit(); // form validation success, call ajax form submit
$('#nav-dashboard').removeClass( '' ).addClass( 'active open' );
$('#nav-easydex').removeClass( 'active open' ).addClass( '' );
$('#nav-about-iguana').removeClass( 'active open' ).addClass( '' );
}
});
$('.login-form input').keypress(function(e) {
if (e.which == 13) {
if ($('.login-form').validate().form()) {
$('.login-form').submit(); //form validation success, call ajax form submit
$('.login-form').submit(); // form validation success, call ajax form submit
}
return false;
}
});
@ -187,41 +172,27 @@ var Login = function() {
}
var handleRegister = function() {
$('.register-form').validate({
errorElement: 'span', //default input error message container
errorElement: 'span', // default input error message container
errorClass: 'help-block', // default input error message class
focusInvalid: false, // do not focus the last invalid input
ignore: "",
ignore: '',
rules: {
walletseed: {
required: true
},
rwalletseed: {
equalTo: "#walletseed"
},
/*password: {
required: true
},
rpassword: {
equalTo: "#register_password"
},*/
equalTo: '#walletseed'
}
},
messages: {
rwalletseed: {
required: "Wallet seed is required."
required: 'Wallet seed is required.'
}
},
invalidHandler: function(event, validator) { //display error alert on form submit
invalidHandler: function(event, validator) { // display error alert on form submit
},
@ -236,7 +207,7 @@ var Login = function() {
},
errorPlacement: function(error, element) {
if (element.attr("name") == "backupconfirm") { // insert checkbox errors after the container
if (element.attr('name') == 'backupconfirm') { // insert checkbox errors after the container
error.insertAfter($('#register_backupconfirm_error'));
} else if (element.closest('.input-icon').size() === 1) {
error.insertAfter(element.closest('.input-icon'));
@ -248,78 +219,90 @@ var Login = function() {
submitHandler: function(form) {
swal({
title: 'Have you saved your wallet seed?',
text: "Make sure you have it backed up. Without this seed you won't be able to access your wallet in the future!",
text: 'Make sure you have it backed up. Without this seed you won\'t be able to access your wallet in the future!',
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, I have taken backup.'
}).then(function() {
//swal('Deleted!', 'Your file has been deleted.', 'success' );
var tmpIguanaRPCAuth = 'tmpIgRPCUser@'+sessionStorage.getItem('IguanaRPCAuth');
var ajax_data = {'userpass':tmpIguanaRPCAuth,"agent":"bitcoinrpc","method":"encryptwallet",'passphrase': $('#walletseed').val()}
})
.then(function() {
var tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
ajax_data = {
'userpass': tmpIguanaRPCAuth,
'agent': 'bitcoinrpc',
'method': 'encryptwallet',
'passphrase': $('#walletseed').val()
};
// Use AJAX to post the object to login user
$.ajax({
type: 'POST',
data: ajax_data,
data: JSON.stringify(ajax_data),
url: 'http://127.0.0.1:7778',
//dataType: 'text',
success: function(data, textStatus, jqXHR) {
var CreateWalletOutput = JSON.parse(data);
//console.log(sessionStorage);
//console.log('== Data OutPut ==');
//console.log(CreateWalletOutput);
if (CreateWalletOutput.result === 'success') {
console.log('Success');
//swal("Success", "Login Successfully.", "success");
toastr.success("Wallet created successfully", "Account Notification")
//Iguana_DEXImportAll();
toastr.success('Wallet created successfully', 'Account Notification');
// Iguana_DEXImportAll();
$('#wallet-handle').val('')
$('#password').val('')
}
else {
$('#wallet-handle').val('');
$('#password').val('');
} else {
// If something goes wrong, alert the error message that our service returned
//swal("Oops...", "Something went wrong!", "error");
toastr.warning("Opps... Something went wrong!", "Account Notification")
console.log(CreateWalletOutput)
toastr.warning('Opps... Something went wrong!', 'Account Notification');
console.log(CreateWalletOutput);
if (CreateWalletOutput.error === 'bitcoinrpc needs coin that is active') {
toastr.info("Seems like there's no coin running. Activating BTC.", "Coin Notification");
var logincoinnames = []; $('#logincoinslist input[type=checkbox]:checked').each(function() { logincoinnames.push(this.value); }); console.log(logincoinnames);
toastr.info('Seems like there\'s no coin running. Activating BTC.', 'Coin Notification');
var logincoinnames = [];
$('#logincoinslist input[type=checkbox]:checked').each(function() { logincoinnames.push(this.value); });
console.log(logincoinnames);
$.each(logincoinnames, function( index, value ) {
if ( value == 'BTC' ) {
var logincoinmodeval = $("input[name='logincoinbtcmode']:checked").val();
var logincoin_data = {"coin": value, "mode": logincoinmodeval, "reload": false};
var logincoinmodeval = $('input[name="logincoinbtcmode"]:checked').val(),
logincoin_data = {
'coin': value,
'mode': logincoinmodeval,
'reload': false
};
Iguana_addcoin(logincoin_data);
if (index == '0' ) {
console.log(value+' '+index);
console.log(value + ' ' + index);
$('.register-form').submit();
toastr.success("Wallet created successfully", "Account Notification")
toastr.success('Wallet created successfully', 'Account Notification');
}
}
if ( value == 'BTCD' ) {
var logincoinmodeval = $("input[name='logincoinbtcdmode']:checked").val();
var logincoin_data = {"coin": value, "mode": logincoinmodeval, "reload": false};
var logincoinmodeval = $('input[name="logincoinbtcdmode"]:checked').val(),
logincoin_data = {
'coin': value,
'mode': logincoinmodeval,
'reload': false
};
Iguana_addcoin(logincoin_data);
if (index == '0' ) {
console.log(value+' '+index);
console.log(value + ' ' + index);
$('.register-form').submit();
toastr.success("Wallet created successfully", "Account Notification")
toastr.success('Wallet created successfully', 'Account Notification');
}
}
});
} else {
toastr.warning("Opps... Something went wrong!", "Account Notification");
toastr.warning('Opps... Something went wrong!', 'Account Notification');
}
console.log(data.statusText);
if ( data.readyState == 0 ) {
Iguana_ServiceUnavailable();
}
console.log(textStatus);
console.log(jqXHR);
}
},
error: function(xhr, textStatus, error) {
@ -330,30 +313,26 @@ var Login = function() {
}
console.log(textStatus);
console.log(error);
//swal("Oops...", "Something went wrong!", "error");
toastr.warning("Opps... Something went wrong!", "Account Notification")
toastr.warning('Opps... Something went wrong!', 'Account Notification');
}
});
$('#section-login').fadeIn();
$('#section-register').hide();
$('#walletseed').text(PassPhraseGenerator.generatePassPhrase(256));
$('#rwalletseed').val('')
$('#register_password').val('')
$('#rpassword').val('')
})
//form.submit();
$('#rwalletseed').val('');
$('#register_password').val('');
$('#rpassword').val('');
});
}
});
$('.register-form input').keypress(function(e) {
if (e.which == 13) {
if ($('.register-form').validate().form()) {
$('.register-form').submit();
}
return false;
}
});
@ -370,40 +349,40 @@ var Login = function() {
$('#section-login').fadeIn();
$('#section-register').hide();
});
}
var handleLogout = function() {
$('#logout-account').click(function() {
$('#section-login-addcoin-btn').hide();
$('#section-login').show();
var tmpIguanaRPCAuth = 'tmpIgRPCUser@'+sessionStorage.getItem('IguanaRPCAuth');
var ajax_data = {'userpass':tmpIguanaRPCAuth,"agent":"bitcoinrpc","method":"walletlock"}
var tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
ajax_data = {
'userpass': tmpIguanaRPCAuth,
'agent': 'bitcoinrpc',
'method': 'walletlock'
};
$.ajax({
type: 'POST',
data: JSON.stringify(ajax_data),
//url: 'http://127.0.0.1:7778/api/bitcoinrpc/walletlock',
url: 'http://127.0.0.1:7778',
//dataType: 'text',
success: function(data, textStatus, jqXHR) {
var LogoutOutput = JSON.parse(data);
//sessionStorage.clear();
// sessionStorage.clear();
sessionStorage.removeItem('IguanaActiveAccount');
console.log('== Logout Data OutPut ==');
console.log(LogoutOutput);
if (LogoutOutput.result === 'success') {
console.log('Success');
//swal("Success", "Logout Successfully.", "success");
toastr.success("Logout Successfull", "Account Notification")
toastr.success('Logout Successfull', 'Account Notification');
$('#wallet-login').show();
$('body').removeClass( "" ).addClass( "page-login layout-full page-dark" );
$('body').removeClass( '' ).addClass( 'page-login layout-full page-dark' );
$('#wallet-core').hide();
$('link[id=loginStyle]')[0].disabled=false;
$('link[id=loginStyle]')[0].disabled = false;
//Make sure these fields are unhidden.
// Make sure these fields are unhidden.
$('#login-welcome').text('Welcome.');
$('#wallet-handle').show();
$('.create-account').show();
@ -414,19 +393,15 @@ var Login = function() {
//Stop SetInterval Calls
StopShowCoinHistory();
StopTotalFiatValue();
}
else {
} else {
// If something goes wrong, alert the error message that our service returned
//swal("Oops...", "Something went wrong!", "error");
toastr.warning("Opps... Something went wrong!", "Account Notification")
toastr.warning('Opps... Something went wrong!', 'Account Notification');
console.log(data.statusText);
if ( xhr.readyState == 0 ) {
Iguana_ServiceUnavailable();
}
console.log(textStatus);
console.log(jqXHR);
}
},
error: function(xhr, textStatus, error) {
@ -437,73 +412,75 @@ var Login = function() {
}
console.log(textStatus);
console.log(error);
//swal("Oops...", "Something went wrong!", "error");
toastr.warning("Opps... Something went wrong!", "Account Notification")
toastr.warning('Opps... Something went wrong!', 'Account Notification');
}
});
});
};
var handleLock = function() {
//Begin Lock Active Wallet
// Begin Lock Active Wallet
$('#lock-screen').click(function() {
$('#section-login-addcoin-btn').hide();
$('#section-login').show();
var tmpIguanaRPCAuth = 'tmpIgRPCUser@'+sessionStorage.getItem('IguanaRPCAuth');
var ajax_data = {'userpass':tmpIguanaRPCAuth,"agent":"bitcoinrpc","method":"walletlock"}
var tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
ajax_data = {
'userpass': tmpIguanaRPCAuth,
'agent': 'bitcoinrpc',
'method': 'walletlock'
};
$.ajax({
type: 'POST',
data: JSON.stringify(ajax_data),
//url: 'http://127.0.0.1:7778/api/bitcoinrpc/walletlock',
url: 'http://127.0.0.1:7778',
success: function(data, textStatus, jqXHR) {
var LockOutput = JSON.parse(data);
// Begin Check Active Wallet's status
var tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
ajax_data_activehandle = {
'userpass': tmpIguanaRPCAuth,
'agent': 'SuperNET',
'method': 'activehandle'
};
//Begin Check Active Wallet's status
var tmpIguanaRPCAuth = 'tmpIgRPCUser@'+sessionStorage.getItem('IguanaRPCAuth');
var ajax_data_activehandle = {'userpass':tmpIguanaRPCAuth,"agent":"SuperNET","method":"activehandle"}
$.ajax({
type: 'POST',
data: JSON.stringify(ajax_data_activehandle),
url: 'http://127.0.0.1:7778',
//url: 'http://127.0.0.1:7778/api/SuperNET/activehandle',
//dataType: 'text',
success: function(data, textStatus, jqXHR) {
var ActiveHandleOutput = JSON.parse(data);
var ActiveHandleDataToStore = JSON.stringify(data);
var ActiveHandleOutput = JSON.parse(data),
ActiveHandleDataToStore = JSON.stringify(data);
sessionStorage.setItem('IguanaActiveAccount', ActiveHandleDataToStore);
console.log('== Data OutPut - Active Handle ==');
console.log(ActiveHandleOutput);
if (ActiveHandleOutput.status === 'locked') {
console.log('Success');
//swal("Success", "Wallet Locked Successfully.", "success");
toastr.success("Wallet Locked Successfully", "Account Notification")
toastr.success('Wallet Locked Successfully', 'Account Notification');
$('#wallet-login').show();
$('body').removeClass( "" ).addClass( "page-login layout-full page-dark" );
$('body').removeClass( '' ).addClass( 'page-login layout-full page-dark' );
$('#wallet-core').hide();
$('link[id=loginStyle]')[0].disabled=false;
$('link[id=loginStyle]')[0].disabled = false;
$("#loginbtn").text('Unlock');
//Hide some login fields not needing at lock screen
// Hide some login fields not needing at lock screen
console.log('Wallet is Locked.');
$('#login-welcome').text('Wallet Locked. Please login.');
$('#register-btn').hide();
$('#logint-another-wallet').show();
$('#logincoinslist').hide();
}
else {
} else {
// If something goes wrong, alert the error message that our service returned
//swal("Oops...", "Something went wrong!", "error");
toastr.warning("Opps... Something went wrong!", "Account Notification")
toastr.warning('Opps... Something went wrong!', 'Account Notification');
console.log(data.statusText);
if ( xhr.readyState == 0 ) {
Iguana_ServiceUnavailable();
}
console.log(textStatus);
console.log(jqXHR);
}
},
error: function(xhr, textStatus, error) {
@ -514,15 +491,12 @@ var Login = function() {
}
console.log(textStatus);
console.log(error);
//swal("Oops...", "Something went wrong!", "error");
toastr.warning("Opps... Something went wrong!", "Account Notification")
toastr.warning('Opps... Something went wrong!', 'Account Notification');
}
});
//End Check Active Wallet's status
//console.log('== Data OutPut - Wallet Lock ==');
//console.log(LockOutput);
// End Check Active Wallet's status
// console.log('== Data OutPut - Wallet Lock ==');
// console.log(LockOutput);
},
error: function(xhr, textStatus, error) {
console.log('failure');
@ -532,45 +506,37 @@ var Login = function() {
}
console.log(textStatus);
console.log(error);
//swal("Oops...", "Something went wrong!", "error");
toastr.warning("Opps... Something went wrong!", "Account Notification")
toastr.warning('Opps... Something went wrong!', 'Account Notification');
}
});
});
//End Lock Active Wallet
// End Lock Active Wallet
};
var handleCheckLogin = function() {
//Iguana_activehandle();
//console.log('Iguana_activehandle_output: '+Iguana_activehandle_output);
if ( sessionStorage.getItem('IguanaActiveAccount') === null ) {
console.log('There\'s no active wallet logged in. Please Login.');
$('#logint-another-wallet').hide();
Iguana_CheckActiveCoins().then(function(result){
//console.log(result)
Iguana_CheckActiveCoins().then(function(result) {
if (result.length !== 0 ) {
$('#section-login-addcoin-btn').hide();
$('#section-login').show();
}
})
});
} else {
var CheckLoginData = JSON.parse(sessionStorage.getItem('IguanaActiveAccount'));
Iguana_activehandle().then(function(result){
//console.log(result)
Iguana_activehandle().then(function(result) {
if ( JSON.parse(CheckLoginData).pubkey != result.pubkey ) {
//console.log("Login: sessionStorage data and activehandle data doesn't match");
//console.log('result: '+result.rmd160);
//console.log('CheckLoginData: ' + JSON.parse(CheckLoginData).rmd160);
ClearOnLogout(false, false);
}
})
});
if ( JSON.parse(CheckLoginData).status === 'unlocked' ) {
console.log(JSON.parse(CheckLoginData).status);
$('#password').val('')
$('#wallet-login').hide();
$('body').removeClass( "page-login layout-full page-dark" ).addClass( "" );
$('body').removeClass( 'page-login layout-full page-dark' ).addClass( '' );
$('#wallet-core').fadeIn();
} else if ( JSON.parse(CheckLoginData).status === 'locked' ) {
console.log('Wallet is Locked.');
@ -583,22 +549,20 @@ var Login = function() {
}
if ( sessionStorage.getItem('IguanaRPCAuth') === null || typeof sessionStorage.getItem('IguanaRPCAuth') == undefined) {
Iguana_SetRPCAuth();
typeof sessionStorage.getItem('IguanaRPCAuth')
typeof sessionStorage.getItem('IguanaRPCAuth');
console.log(sessionStorage.getItem('IguanaRPCAuth'));
var tmpIguanaRPCAuth = 'tmpIgRPCUser@'+sessionStorage.getItem('IguanaRPCAuth');
console.log(tmpIguanaRPCAuth)
var tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth');
console.log(tmpIguanaRPCAuth);
}
};
var handleCoinsRunningCheck = function() {
Iguana_CheckActiveCoins().then(function(result){
//console.log(result)
Iguana_CheckActiveCoins().then(function(result) {
if (result.length !== 0 ) {
$('#section-login-addcoin-btn').hide();
$('#section-login').show();
}
})
});
/*$.each([ 'basilisk', 'full', 'virtual' ], function( index, value ) {
var allcoinsvalues = {"agent":"InstantDEX","method":"allcoins"};
@ -628,8 +592,6 @@ var Login = function() {
}
});
});
if ( sessionStorage.getItem('IguanaActiveAccount') === null ) {
$.each([ 'BTC', 'BTCD' ], function( index, value ) {
var AddCoinBasiliskData = {
@ -679,15 +641,18 @@ var Login = function() {
});
});
}*/
}
var handleLoginAnotherWallet = function() {
$('#logint-another-wallet').click(function() {
var tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
ajax_data = {
'userpass': tmpIguanaRPCAuth,
'agent': 'bitcoinrpc',
'method': 'walletlock'
};
$('#logint-another-wallet').show();
var tmpIguanaRPCAuth = 'tmpIgRPCUser@'+sessionStorage.getItem('IguanaRPCAuth');
var ajax_data = {'userpass':tmpIguanaRPCAuth,"agent":"bitcoinrpc","method":"walletlock"}
$.ajax({
type: 'POST',
data: JSON.stringify(ajax_data),
@ -696,32 +661,26 @@ var Login = function() {
var LogoutOutput = JSON.parse(data);
//sessionStorage.clear();
sessionStorage.removeItem('IguanaActiveAccount');
//console.log('== Data OutPut ==');
//console.log(LogoutOutput);
if (LogoutOutput.result === 'success') {
console.log('Success');
//swal("Success", "Logout Successfully.", "success");
toastr.success("Logout Successfull", "Account Notification")
toastr.success('Logout Successfull', 'Account Notification');
$('#wallet-login').show();
$('body').removeClass( "" ).addClass( "page-login layout-full page-dark" );
$('body').removeClass( '' ).addClass( 'page-login layout-full page-dark' );
$('#wallet-core').hide();
$('link[id=loginStyle]')[0].disabled=false;
$('link[id=loginStyle]')[0].disabled = false;
//Make sure these fields are unhidden.
// Make sure these fields are unhidden.
$('#login-welcome').text('Welcome. Please login.');
$('.create-account').show();
$('#register-btn').show();
$('#logint-another-wallet').hide();
$("#loginbtn").text('Sign in');
$('#logincoinslist').show();
}
else {
} else {
// If something goes wrong, alert the error message that our service returned
//swal("Oops...", "Something went wrong!", "error");
toastr.warning("Opps... Something went wrong!", "Account Notification")
toastr.warning('Opps... Something went wrong!', 'Account Notification');
console.log(data.statusText);
if ( xhr.readyState == 0 ) {
Iguana_ServiceUnavailable();
@ -738,8 +697,7 @@ var Login = function() {
}
console.log(textStatus);
console.log(error);
//swal("Oops...", "Something went wrong!", "error");
toastr.warning("Opps... Something went wrong!", "Account Notification")
toastr.warning('Opps... Something went wrong!', 'Account Notification');
}
});
});
@ -749,75 +707,74 @@ var Login = function() {
$('#addcoin_mdl_native_mode_login').prop('disabled', true);
$('#addcoin_mdl_basilisk_mode_login').prop('disabled', true);
$('#addcoin_mdl_full_mode_login').prop('disabled', true);
$('#addcoin_mdl_full_mode_login').prop("checked", false);
$('#addcoin_mdl_full_mode_login').prop('checked', false);
$('.mdl_addcoin_done_btn-login').click(function(){
$('.mdl_addcoin_done_btn-login').click(function() {
ExecuteAddCoinLoginFn();
});
$( "#addcoin_select_coin_mdl_options-login" ).change(function() {
var tmp_coin_val = $('#addcoin_select_coin_mdl_options-login').val()
var tmp_coin_val = $('#addcoin_select_coin_mdl_options-login').val();
if (tmp_coin_val !== 'KMD' || tmp_coin_val !== 'KMD' ) {
$('#addcoin_mdl_native_mode_login').prop('disabled', true);
$('#addcoin_mdl_basilisk_mode_login').prop('disabled', true);
$('#addcoin_mdl_full_mode_login').prop('disabled', false);
$('#addcoin_mdl_full_mode_login').prop("checked", true);
$('#addcoin_mdl_full_mode_login').prop('checked', true);
}
if (tmp_coin_val == 'KMD') {
$('#addcoin_mdl_native_mode_login').prop('disabled', false);
$('#addcoin_mdl_basilisk_mode_login').prop('disabled', false);
$('#addcoin_mdl_full_mode_login').prop('disabled', false);
$('#addcoin_mdl_basilisk_mode_login').prop("checked", true);
$('#addcoin_mdl_basilisk_mode_login').prop('checked', true);
}
if (tmp_coin_val == 'SUPERNET'
|| tmp_coin_val == 'REVS'
|| tmp_coin_val == 'USD') {
if (tmp_coin_val == 'SUPERNET' ||
tmp_coin_val == 'REVS' ||
tmp_coin_val == 'USD') {
$('#addcoin_mdl_native_mode_login').prop('disabled', true);
$('#addcoin_mdl_basilisk_mode_login').prop('disabled', false);
$('#addcoin_mdl_full_mode_login').prop('disabled', true);
$('#addcoin_mdl_basilisk_mode_login').prop("checked", true);
$('#addcoin_mdl_basilisk_mode_login').prop('checked', true);
}
if (tmp_coin_val == 'BTC') {
$('#addcoin_mdl_basilisk_mode_login').prop('disabled', false);
$('#addcoin_mdl_native_mode_login').prop('disabled', true);
$('#addcoin_mdl_full_mode_login').prop('disabled', false);
$('#addcoin_mdl_basilisk_mode_login').prop("checked", true);
$('#addcoin_mdl_basilisk_mode_login').prop('checked', true);
}
});
}
var handleAddCoinOSOptions = function() {
if ( navigator.platform == 'Win32' //|| navigator.platform == 'MacIntel'
//|| navigator.platform == 'Linux x86_64' || navigator.platform == 'Linux' || navigator.platform == 'Linux i686'
if ( navigator.platform == 'Win32' // || navigator.platform == 'MacIntel'
// || navigator.platform == 'Linux x86_64' || navigator.platform == 'Linux' || navigator.platform == 'Linux i686'
) {
//Conditions for Login Add Coin Dialog
// Conditions for Login Add Coin Dialog
$.each($('.style-addcoin-lbl-mdl-login'), function(index, value) {
if ( index == 0 || index == 1 ) {
$(value).removeClass('col-lg-4 col-md-4').addClass('col-lg-6 col-md-6')
$(value).removeClass('col-lg-4 col-md-4').addClass('col-lg-6 col-md-6');
}
if ( index == 2 ) {
$(value).hide()
$(value).hide();
}
});
//Conditions for Dashboard Add Coin Dialog
// Conditions for Dashboard Add Coin Dialog
$.each($('.style-addcoin-lbl-mdl'), function(index, value) {
if ( index == 0 || index == 1 ) {
$(value).removeClass('col-lg-4 col-md-4').addClass('col-lg-6 col-md-6')
$(value).removeClass('col-lg-4 col-md-4').addClass('col-lg-6 col-md-6');
}
if ( index == 2 ) {
$(value).hide()
$(value).hide();
}
});
}
}
return {
//main function to initiate the module
// main function to initiate the module
init: function() {
//handleCoinsRunningCheck();
// handleCoinsRunningCheck();
handleLogin();
handleLock();
handleRegister();
@ -825,29 +782,24 @@ var Login = function() {
handleCheckLogin();
handleLoginAnotherWallet();
handleAddCoinLoginBtn();
//handleAddCoinOSOptions();
// handleAddCoinOSOptions();
}
};
}();
jQuery(document).ready(function() {
Login.init();
});
function ClearOnLogout(cleardata, stopinterval) {
if ( cleardata === true ) {
//sessionStorage.clear();
sessionStorage.removeItem('IguanaActiveAccount');
}
if ( cleardata === false || cleardata === null ) {
console.log('sessionStorage data not cleared.');
}
if ( stopinterval === true ) {
//Stop SetInterval Calls
// Stop SetInterval Calls
StopShowCoinHistory();
StopTotalFiatValue();
}
@ -855,12 +807,12 @@ function ClearOnLogout(cleardata, stopinterval) {
console.log('SetInterval data not cleared.');
}
$('#wallet-login').show();
$('body').removeClass( "" ).addClass( "page-login layout-full page-dark" );
$('body').removeClass( '' ).addClass( 'page-login layout-full page-dark' );
$('#wallet-core').hide();
$('link[id=loginStyle]')[0].disabled=false;
$('link[id=loginStyle]')[0].disabled = false;
$('#logint-another-wallet').hide();
//Make sure these fields are unhidden.
// Make sure these fields are unhidden.
$('#login-welcome').text('Welcome.');
$('#wallet-handle').show();
$('.create-account').show();

211
assets/scripts/sidebar.js

@ -24,7 +24,7 @@ $(document).ready(function() {
$('#nav-dashboard').on('click', function() {
$('#section-dashboard').show();
var active_edexcoin = $('[data-edexcoin]').attr("data-edexcoin");
var active_edexcoin = $('[data-edexcoin]').attr('data-edexcoin');
if (active_edexcoin !== 'COIN') {
$('#header-dashboard').show();
}
@ -34,16 +34,16 @@ $('#nav-dashboard').on('click', function() {
$('#section-iguana-atomic-explorer').hide();
$('#section-iguana-wallet-settings').hide();
$('#section-about-iguana').hide();
$('#nav-dashboard').removeClass( "" ).addClass( "active open" );
$('#nav-easydex').removeClass( " active open" ).addClass( "" );
$('#nav-komodo-wallet').removeClass( " active open" ).addClass( "" );
$('#nav-zcash-wallet').removeClass( " active open" ).addClass( "" );
$('#nav-iguana-atomic-explorer').removeClass( " active open" ).addClass( "" );
$('#nav-iguana-wallet-settings').removeClass( " active open" ).addClass( "" );
$('#nav-about-iguana').removeClass( " active open" ).addClass( "" );
$(".header-easydex-section").text("Dashboard");
$.each($('.nav-top-menu'), function(index, value) { $(value).removeClass('active') });
$(this.parentElement).addClass('active')
$('#nav-dashboard').removeClass( '' ).addClass( 'active open' );
$('#nav-easydex').removeClass( 'active open' ).addClass( '' );
$('#nav-komodo-wallet').removeClass( 'active open' ).addClass( '' );
$('#nav-zcash-wallet').removeClass( 'active open' ).addClass( '' );
$('#nav-iguana-atomic-explorer').removeClass( 'active open' ).addClass( '' );
$('#nav-iguana-wallet-settings').removeClass( 'active open' ).addClass( '' );
$('#nav-about-iguana').removeClass( 'active open' ).addClass( '' );
$(".header-easydex-section").text('Dashboard');
$.each($('.nav-top-menu'), function(index, value) { $(value).removeClass('active'); });
$(this.parentElement).addClass('active');
removeKMDWalletStyle();
removeZECWalletStyle();
CommonSidebarActionsSet011();
@ -59,15 +59,15 @@ $('#nav-easydex').on('click', function() {
$('#section-about-iguana').hide();
$('#section-iguana-atomic-explorer').hide();
$('#section-iguana-wallet-settings').hide();
$('#nav-dashboard').removeClass( " active open" ).addClass( "" );
$('#nav-easydex').removeClass( "" ).addClass( "active open" );
$('#nav-komodo-wallet').removeClass( " active open" ).addClass( "" );
$('#nav-zcash-wallet').removeClass( " active open" ).addClass( "" );
$('#nav-iguana-atomic-explorer').removeClass( " active open" ).addClass( "" );
$('#nav-iguana-wallet-settings').removeClass( " active open" ).addClass( "" );
$('#nav-about-iguana').removeClass( " active open" ).addClass( "" );
$(".header-easydex-section").text("EasyDEX");
$.each($('.nav-top-menu'), function(index, value) { $(value).removeClass('active') });
$('#nav-dashboard').removeClass( 'active open' ).addClass( '' );
$('#nav-easydex').removeClass( '' ).addClass( 'active open' );
$('#nav-komodo-wallet').removeClass( 'active open' ).addClass( '' );
$('#nav-zcash-wallet').removeClass( 'active open' ).addClass( '' );
$('#nav-iguana-atomic-explorer').removeClass( 'active open' ).addClass( '' );
$('#nav-iguana-wallet-settings').removeClass( 'active open' ).addClass( '' );
$('#nav-about-iguana').removeClass( 'active open' ).addClass( '' );
$(".header-easydex-section").text('EasyDEX');
$.each($('.nav-top-menu'), function(index, value) { $(value).removeClass('active'); });
$(this.parentElement).addClass('active')
removeKMDWalletStyle();
removeZECWalletStyle();
@ -84,21 +84,30 @@ $('#nav-komodo-wallet').on('click', function() {
$('#section-about-iguana').hide();
$('#section-iguana-atomic-explorer').hide();
$('#section-iguana-wallet-settings').hide();
$('#nav-dashboard').removeClass( " active open" ).addClass( "" );
$('#nav-easydex').removeClass( " active open" ).addClass( "" );
$('#nav-komodo-wallet').removeClass( "" ).addClass( "active open" );
$('#nav-zcash-wallet').removeClass( " active open" ).addClass( "" );
$('#nav-iguana-atomic-explorer').removeClass( " active open" ).addClass( "" );
$('#nav-iguana-wallet-settings').removeClass( " active open" ).addClass( "" );
$('#nav-about-iguana').removeClass( " active open" ).addClass( "" );
//$.each($('[data-extcoin="KMD"]'), function(index, value) {console.log($('[data-extcoin="KMD"]').data()); $('[data-extcoin="KMD"]').attr("data-extcoin","ZEC"); });
$.each($('[data-extcoin]'), function(index, value) {$('[data-extcoin]').attr("data-extcoin","KMD"); $('[data-extcoin="KMD"]')});
$.each($('[data-extcoinname]'), function(index, value) {$('[data-extcoinname]').text("KMD"); $('[data-extcoinname="KMD"]')});
$.each($('[data-extcointitle]'), function(index, value) {$('[data-extcointitle]').text("Komodo"); $('[data-extcointitle="Komodo"]')});
KMDWalletDashboard.init(); //Initiate Komodo Dashbaord sript
$('#nav-dashboard').removeClass( 'active open' ).addClass( '' );
$('#nav-easydex').removeClass( 'active open' ).addClass( '' );
$('#nav-komodo-wallet').removeClass( '' ).addClass( 'active open' );
$('#nav-zcash-wallet').removeClass( 'active open' ).addClass( '' );
$('#nav-iguana-atomic-explorer').removeClass( 'active open' ).addClass( '' );
$('#nav-iguana-wallet-settings').removeClass( 'active open' ).addClass( '' );
$('#nav-about-iguana').removeClass( 'active open' ).addClass( '' );
$.each($('[data-extcoin]'), function(index, value) {
$('[data-extcoin]').attr('data-extcoin', 'KMD');
$('[data-extcoin="KMD"]');
});
$.each($('[data-extcoinname]'), function(index, value) {
$('[data-extcoinname]').text('KMD');
$('[data-extcoinname="KMD"]');
});
$.each($('[data-extcointitle]'), function(index, value) {
$('[data-extcointitle]').text('Komodo');
$('[data-extcointitle="Komodo"]');
});
KMDWalletDashboard.init(); // Initiate Komodo Dashboard sript
RunKMDInitFunctions();
applyKMDWalletStyle();
//removeZECWalletStyle();
// removeZECWalletStyle();
CommonSidebarActionsSet02();
removeDashboardStyle();
});
@ -106,30 +115,44 @@ $('#nav-komodo-wallet').on('click', function() {
$('#nav-zcash-wallet').on('click', function() {
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();
$('#section-dashboard').hide();
$('#header-dashboard').hide();
$('#section-easydex').hide();
$('#section-extcoin').hide();
//$('#section-zcash').show();
// $('#section-zcash').show();
$('#section-extcoin').show();
$('#section-about-iguana').hide();
$('#section-iguana-atomic-explorer').hide();
$('#section-iguana-wallet-settings').hide();
$('#nav-dashboard').removeClass( " active open" ).addClass( "" );
$('#nav-easydex').removeClass( " active open" ).addClass( "" );
$('#nav-komodo-wallet').removeClass( " active open" ).addClass( "" );
$('#nav-zcash-wallet').removeClass( "" ).addClass( "active open" );
$('#nav-iguana-atomic-explorer').removeClass( " active open" ).addClass( "" );
$('#nav-iguana-wallet-settings').removeClass( " active open" ).addClass( "" );
$('#nav-about-iguana').removeClass( " active open" ).addClass( "" );
$(".header-easydex-section").text("Zcash Wallet");
$.each($('[data-extcoin]'), function(index, value) {$('[data-extcoin]').attr("data-extcoin","ZEC"); $('[data-extcoin="ZEC"]')});
$.each($('[data-extcoinname]'), function(index, value) {$('[data-extcoinname]').text("ZEC"); $('[data-extcoinname="ZEC"]')});
$.each($('[data-extcointitle]'), function(index, value) {$('[data-extcointitle]').text("Zcash"); $('[data-extcointitle="Zcash"]')});
KMDWalletDashboard.init(); //Initiate Komodo Dashbaord sript
$('#nav-dashboard').removeClass( 'active open' ).addClass( '' );
$('#nav-easydex').removeClass( 'active open' ).addClass( '' );
$('#nav-komodo-wallet').removeClass( 'active open' ).addClass( '' );
$('#nav-zcash-wallet').removeClass( '' ).addClass( 'active open' );
$('#nav-iguana-atomic-explorer').removeClass( 'active open' ).addClass( '' );
$('#nav-iguana-wallet-settings').removeClass( 'active open' ).addClass( '' );
$('#nav-about-iguana').removeClass( 'active open' ).addClass( '' );
$(".header-easydex-section").text('Zcash Wallet');
$.each($('[data-extcoin]'), function(index, value) {
$('[data-extcoin]').attr('data-extcoin', 'ZEC');
$('[data-extcoin="ZEC"]');
});
$.each($('[data-extcoinname]'), function(index, value) {
$('[data-extcoinname]').text('ZEC');
$('[data-extcoinname="ZEC"]');
});
$.each($('[data-extcointitle]'), function(index, value) {
$('[data-extcointitle]').text('Zcash');
$('[data-extcointitle="Zcash"]');
});
KMDWalletDashboard.init(); // Initiate Komodo Dashbaord sript
RunKMDInitFunctions();
applyZECWalletStyle();
//removeKMDWalletStyle();
@ -147,16 +170,16 @@ $('#nav-iguana-atomic-explorer').on('click', function() {
$('#section-iguana-atomic-explorer').show();
$('#section-iguana-wallet-settings').hide();
$('#section-about-iguana').hide();
$('#nav-dashboard').removeClass( " active open" ).addClass( "" );
$('#nav-easydex').removeClass( " active open" ).addClass( "" );
$('#nav-komodo-wallet').removeClass( " active open" ).addClass( "" );
$('#nav-zcash-wallet').removeClass( " active open" ).addClass( "" );
$('#nav-about-iguana').removeClass( " active open" ).addClass( "" );
$('#nav-iguana-wallet-settings').removeClass( " active open" ).addClass( "" );
$('#nav-iguana-atomic-explorer').removeClass( "" ).addClass( "active open" );
$(".header-easydex-section").text("Atomic Explorer");
$.each($('.nav-top-menu'), function(index, value) { $(value).removeClass('active') });
$(this.parentElement).addClass('active')
$('#nav-dashboard').removeClass( 'active open' ).addClass( '' );
$('#nav-easydex').removeClass( 'active open' ).addClass( '' );
$('#nav-komodo-wallet').removeClass( 'active open' ).addClass( '' );
$('#nav-zcash-wallet').removeClass( 'active open' ).addClass( '' );
$('#nav-about-iguana').removeClass( 'active open' ).addClass( '' );
$('#nav-iguana-wallet-settings').removeClass( 'active open' ).addClass( '' );
$('#nav-iguana-atomic-explorer').removeClass( '' ).addClass( 'active open' );
$(".header-easydex-section").text('Atomic Explorer');
$.each($('.nav-top-menu'), function(index, value) { $(value).removeClass('active'); });
$(this.parentElement).addClass('active');
removeKMDWalletStyle();
removeZECWalletStyle();
CommonSidebarActionsSet02();
@ -173,17 +196,17 @@ $('#nav-iguana-wallet-settings').on('click', function() {
$('#section-iguana-atomic-explorer').hide();
$('#section-iguana-wallet-settings').show();
$('#section-about-iguana').hide();
$('#nav-dashboard').removeClass( " active open" ).addClass( "" );
$('#nav-easydex').removeClass( " active open" ).addClass( "" );
$('#nav-komodo-wallet').removeClass( " active open" ).addClass( "" );
$('#nav-zcash-wallet').removeClass( " active open" ).addClass( "" );
$('#nav-about-iguana').removeClass( " active open" ).addClass( "" );
$('#nav-iguana-atomic-explorer').removeClass( " active open" ).addClass( "" );
$('#nav-iguana-wallet-settings').removeClass( "" ).addClass( "active open" );
//$(".header-easydex-section").text("Wallet Settings");
$('#nav-dashboard').removeClass( 'active open' ).addClass( '' );
$('#nav-easydex').removeClass( 'active open' ).addClass( '' );
$('#nav-komodo-wallet').removeClass( 'active open' ).addClass( '' );
$('#nav-zcash-wallet').removeClass( 'active open' ).addClass( '' );
$('#nav-about-iguana').removeClass( 'active open' ).addClass( '' );
$('#nav-iguana-atomic-explorer').removeClass( 'active open' ).addClass( '' );
$('#nav-iguana-wallet-settings').removeClass( '' ).addClass( 'active open' );
// $(".header-easydex-section").text("Wallet Settings");
removeKMDWalletStyle();
removeZECWalletStyle();
Settings_ShowWalletInfo(); //Execute this function from walletsettings.js file
Settings_ShowWalletInfo(); // Execute this function from walletsettings.js file
CommonSidebarActionsSet02();
removeDashboardStyle();
$('#easydex-header-div').hide();
@ -198,14 +221,14 @@ $('#nav-about-iguana').on('click', function() {
$('#section-iguana-atomic-explorer').hide();
$('#section-iguana-wallet-settings').hide();
$('#section-about-iguana').show();
$('#nav-dashboard').removeClass( " active open" ).addClass( "" );
$('#nav-easydex').removeClass( " active open" ).addClass( "" );
$('#nav-komodo-wallet').removeClass( " active open" ).addClass( "" );
$('#nav-zcash-wallet').removeClass( " active open" ).addClass( "" );
$('#nav-iguana-atomic-explorer').removeClass( " active open" ).addClass( "" );
$('#nav-iguana-wallet-settings').removeClass( " active open" ).addClass( "" );
$('#nav-about-iguana').removeClass( "" ).addClass( "active open" );
$(".header-easydex-section").text("About Iguana");
$('#nav-dashboard').removeClass( 'active open' ).addClass( '' );
$('#nav-easydex').removeClass( 'active open' ).addClass( '' );
$('#nav-komodo-wallet').removeClass( 'active open' ).addClass( '' );
$('#nav-zcash-wallet').removeClass( 'active open' ).addClass( '' );
$('#nav-iguana-atomic-explorer').removeClass( 'active open' ).addClass( '' );
$('#nav-iguana-wallet-settings').removeClass( 'active open' ).addClass( '' );
$('#nav-about-iguana').removeClass( '' ).addClass( 'active open' );
$(".header-easydex-section").text('About Iguana');
removeKMDWalletStyle();
removeZECWalletStyle();
CommonSidebarActionsSet02();
@ -213,30 +236,28 @@ $('#nav-about-iguana').on('click', function() {
$('#easydex-header-div').hide();
});
function CommonSidebarActionsSet01() {
sessionStorage.setItem('DashboardActions', "start");
sessionStorage.setItem('NativeWalletActions', "stop");
//$(document).ready(function() { Dashboard.init(); });
sessionStorage.setItem('DashboardActions', 'start');
sessionStorage.setItem('NativeWalletActions', 'stop');
// $(document).ready(function() { Dashboard.init(); });
$("#wifkeys_passphrase").val('');
$('#wif-priv-keys').html('');
}
function CommonSidebarActionsSet011() {
sessionStorage.setItem('DashboardActions', "start");
sessionStorage.setItem('NativeWalletActions', "stop");
//location.reload();
sessionStorage.setItem('DashboardActions', 'start');
sessionStorage.setItem('NativeWalletActions', 'stop');
// location.reload();
$("#wifkeys_passphrase").val('');
$('#wif-priv-keys').html('');
}
function CommonSidebarActionsSet02() {
sessionStorage.setItem('DashboardActions', "stop");
sessionStorage.setItem('DashboardActions', 'stop');
$("#wifkeys_passphrase").val('');
$('#wif-priv-keys').html('');
}
function applyKMDWalletStyle() {
$('.header-easydex-section').html('<img src="assets/images/kmd_header_title_logo.png">');
$('.page-title').hide();
@ -246,19 +267,18 @@ function applyKMDWalletStyle() {
$('#easydex_kmd_wallet_actions_header').show();
$('#easydex_zec_wallet_actions_header').hide();
$('#easydex_btc_btcd_balances_header').hide();
sessionStorage.setItem('NativeWalletActions', "start");
sessionStorage.setItem('NativeWalletActions', 'start');
}
function removeKMDWalletStyle() {
$('.page-title').show();
$('#easydex-header-div').removeAttr( "style" );
$('#easydex-header-div').removeAttr( 'style' );
$('#easydex_kmd_wallet_actions_header').hide();
$('#easydex_zec_wallet_actions_header').hide();
$('#easydex_btc_btcd_balances_header').show();
sessionStorage.setItem('NativeWalletActions', "stop");
sessionStorage.setItem('NativeWalletActions', 'stop');
}
function applyZECWalletStyle() {
$('.header-easydex-section').html('<img src="assets/images/zec_header_title_logo.png">');
$('.page-title').hide();
@ -268,30 +288,29 @@ function applyZECWalletStyle() {
$('#easydex_kmd_wallet_actions_header').hide();
$('#easydex_zec_wallet_actions_header').show();
$('#easydex_btc_btcd_balances_header').hide();
sessionStorage.setItem('NativeWalletActions', "start");
sessionStorage.setItem('NativeWalletActions', 'start');
}
function removeZECWalletStyle() {
$('.page-title').show();
$('#easydex-header-div').removeAttr( "style" );
$('#easydex-header-div').removeAttr( 'style' );
$('#easydex_kmd_wallet_actions_header').hide();
$('#easydex_zec_wallet_actions_header').hide();
$('#easydex_btc_btcd_balances_header').show();
sessionStorage.setItem('NativeWalletActions', "stop");
sessionStorage.setItem('NativeWalletActions', 'stop');
}
function applyDashboardStyle() {
$('.page-aside').show();
$('.page-main').show();
/* set default map height */
var navbarH = $(".site-navbar").outerHeight();
var footerH = $(".site-footer").outerHeight();
var mapH = $(window).height() - navbarH - footerH;
$(".page-main").outerHeight(mapH);
var navbarH = $('.site-navbar').outerHeight(),
footerH = $('.site-footer').outerHeight(),
mapH = $(window).height() - navbarH - footerH;
$('.page-main').outerHeight(mapH);
$('#easydex-header-div').hide();
var active_edexcoinmodecode = sessionStorage.getItem('edexTmpMode');
console.log(active_edexcoinmodecode)
console.log(active_edexcoinmodecode);
if (active_edexcoinmodecode == 'Basilisk') {
$('#edex-footer').hide();
} else {

35
assets/scripts/walletsettings.js

@ -1,9 +1,9 @@
var WalletSettings = function() {
var handleWalletExportKeys = function() {
$('.wifkeys-form').validate({
//errorElement: 'span', //default input error message container
//errorClass: 'help-block', // default input error message class
//focusInvalid: false, // do not focus the last invalid input
// errorElement: 'span', //default input error message container
// errorClass: 'help-block', // default input error message class
// focusInvalid: false, // do not focus the last invalid input
rules: {
wifkeys_passphrase: {
required: true
@ -20,7 +20,7 @@ var WalletSettings = function() {
var Getwifkeys_passphrase = $('#wifkeys_passphrase').val(),
WifKeyDivContent = '';
//First check which coins are active. Execute API for each mode of wallet
// First check which coins are active. Execute API for each mode of wallet
$.each([
'native',
'basilisk',
@ -38,13 +38,13 @@ var WalletSettings = function() {
url: 'http://127.0.0.1:7778',
success: function(data, textStatus, jqXHR) {
var AllcoinsDataOutput = JSON.parse(data);
//Only execute further code if that mode has any coins active it. if none, skill checking on them.
// Only execute further code if that mode has any coins active it. if none, skill checking on them.
if (AllcoinsDataOutput[value].length !== 0 ) {
console.log('== AllCoins Data OutPut ==');
console.log(value);
console.log(AllcoinsDataOutput[value]);
//First Run Encryptwallet API to get wif keys for each active coin
// First Run Encryptwallet API to get wif keys for each active coin
$.each(AllcoinsDataOutput[value], function(index) {
var wifkey_coin_handle = AllcoinsDataOutput[value][index];
@ -125,7 +125,7 @@ var WalletSettings = function() {
$('.wifkeys-form input').keypress(function(e) {
if (e.which == 13) {
if ($('.wifkeys-form').validate().form()) {
$('.wifkeys-form').submit(); //form validation success, call ajax form submit
$('.wifkeys-form').submit(); // form validation success, call ajax form submit
}
return false;
@ -135,9 +135,9 @@ var WalletSettings = function() {
var handleWalletImportKeys = function() {
$('.wifkeys-import-form').validate({
//errorElement: 'span', //default input error message container
//errorClass: 'help-block', // default input error message class
//focusInvalid: false, // do not focus the last invalid input
// errorElement: 'span', //default input error message container
// errorClass: 'help-block', // default input error message class
// focusInvalid: false, // do not focus the last invalid input
rules: {
import_wifkey: {
required: true
@ -150,7 +150,7 @@ var WalletSettings = function() {
},
submitHandler: function(form) {
var Getimport_wifkey = $('#import_wifkey').val();
//console.log(Getimport_wifkey);
// console.log(Getimport_wifkey);
EDEXimportprivkey(Getimport_wifkey).then(function(result){
console.log(result)
if ( result.result !== undefined && result.result == 'success' ) {
@ -168,7 +168,7 @@ var WalletSettings = function() {
$('.wifkeys-import-form input').keypress(function(e) {
if (e.which == 13) {
if ($('.wifkeys-import-form').validate().form()) {
$('.wifkeys-import-form').submit(); //form validation success, call ajax form submit
$('.wifkeys-import-form').submit(); // form validation success, call ajax form submit
}
return false;
@ -177,7 +177,7 @@ var WalletSettings = function() {
};
return {
//main function to initiate the module
// main function to initiate the module
init: function() {
handleWalletExportKeys();
handleWalletImportKeys();
@ -221,7 +221,6 @@ function Settings_ShowCoinPeers() {
type: 'POST',
data: JSON.stringify(ajax_data),
url: 'http://127.0.0.1:7778',
//dataType: 'text',
success: function(data, textStatus, jqXHR) {
var getCoinPeers = JSON.parse(data);
console.log(getCoinPeers);
@ -270,12 +269,10 @@ function Settings_ShowCoinPeers() {
});
}
function Settings_AddCoinPeers() {
console.log('wait till peer ip added to selected coin...')
var settings_selected_coinname_code_val = $('option:selected', '#settings_select_coin_addpeer_options').val(),
settings_add_peer_ip_val = $("#settings_add_peer_ip").val(),
settings_add_peer_ip_val = $('#settings_add_peer_ip').val(),
tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
ajax_data = {
'userpass': tmpIguanaRPCAuth,
@ -289,7 +286,6 @@ function Settings_AddCoinPeers() {
type: 'POST',
data: JSON.stringify(ajax_data),
url: 'http://127.0.0.1:7778',
//dataType: 'text',
success: function(data, textStatus, jqXHR) {
var getAddCoinPeers = JSON.parse(data);
console.log(getAddCoinPeers);
@ -322,9 +318,8 @@ function Settings_LoadDebugLog() {
type: 'POST',
data: ajax_data,
url: 'http://127.0.0.1:17777/shepherd/debuglog',
//dataType: 'text',
success: function(data, textStatus, jqXHR) {
$('#read_debug_log_textarea').text(JSON.parse(data).result.replace('\n', '<br/>'));
$('#read_debug_log_textarea').text(JSON.parse(data).result.replace('\n', '\r\n'));
console.log(data);
},
error: function(xhr, textStatus, error) {

Loading…
Cancel
Save