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

476
assets/scripts/login.js

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

211
assets/scripts/sidebar.js

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

35
assets/scripts/walletsettings.js

@ -1,9 +1,9 @@
var WalletSettings = function() { var WalletSettings = function() {
var handleWalletExportKeys = function() { var handleWalletExportKeys = function() {
$('.wifkeys-form').validate({ $('.wifkeys-form').validate({
//errorElement: 'span', //default input error message container // errorElement: 'span', //default input error message container
//errorClass: 'help-block', // default input error message class // errorClass: 'help-block', // default input error message class
//focusInvalid: false, // do not focus the last invalid input // focusInvalid: false, // do not focus the last invalid input
rules: { rules: {
wifkeys_passphrase: { wifkeys_passphrase: {
required: true required: true
@ -20,7 +20,7 @@ var WalletSettings = function() {
var Getwifkeys_passphrase = $('#wifkeys_passphrase').val(), var Getwifkeys_passphrase = $('#wifkeys_passphrase').val(),
WifKeyDivContent = ''; 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([ $.each([
'native', 'native',
'basilisk', 'basilisk',
@ -38,13 +38,13 @@ var WalletSettings = function() {
url: 'http://127.0.0.1:7778', url: 'http://127.0.0.1:7778',
success: function(data, textStatus, jqXHR) { success: function(data, textStatus, jqXHR) {
var AllcoinsDataOutput = JSON.parse(data); 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 ) { if (AllcoinsDataOutput[value].length !== 0 ) {
console.log('== AllCoins Data OutPut =='); console.log('== AllCoins Data OutPut ==');
console.log(value); console.log(value);
console.log(AllcoinsDataOutput[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) { $.each(AllcoinsDataOutput[value], function(index) {
var wifkey_coin_handle = AllcoinsDataOutput[value][index]; var wifkey_coin_handle = AllcoinsDataOutput[value][index];
@ -125,7 +125,7 @@ var WalletSettings = function() {
$('.wifkeys-form input').keypress(function(e) { $('.wifkeys-form input').keypress(function(e) {
if (e.which == 13) { if (e.which == 13) {
if ($('.wifkeys-form').validate().form()) { 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; return false;
@ -135,9 +135,9 @@ var WalletSettings = function() {
var handleWalletImportKeys = function() { var handleWalletImportKeys = function() {
$('.wifkeys-import-form').validate({ $('.wifkeys-import-form').validate({
//errorElement: 'span', //default input error message container // errorElement: 'span', //default input error message container
//errorClass: 'help-block', // default input error message class // errorClass: 'help-block', // default input error message class
//focusInvalid: false, // do not focus the last invalid input // focusInvalid: false, // do not focus the last invalid input
rules: { rules: {
import_wifkey: { import_wifkey: {
required: true required: true
@ -150,7 +150,7 @@ var WalletSettings = function() {
}, },
submitHandler: function(form) { submitHandler: function(form) {
var Getimport_wifkey = $('#import_wifkey').val(); var Getimport_wifkey = $('#import_wifkey').val();
//console.log(Getimport_wifkey); // console.log(Getimport_wifkey);
EDEXimportprivkey(Getimport_wifkey).then(function(result){ EDEXimportprivkey(Getimport_wifkey).then(function(result){
console.log(result) console.log(result)
if ( result.result !== undefined && result.result == 'success' ) { if ( result.result !== undefined && result.result == 'success' ) {
@ -168,7 +168,7 @@ var WalletSettings = function() {
$('.wifkeys-import-form input').keypress(function(e) { $('.wifkeys-import-form input').keypress(function(e) {
if (e.which == 13) { if (e.which == 13) {
if ($('.wifkeys-import-form').validate().form()) { 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; return false;
@ -177,7 +177,7 @@ var WalletSettings = function() {
}; };
return { return {
//main function to initiate the module // main function to initiate the module
init: function() { init: function() {
handleWalletExportKeys(); handleWalletExportKeys();
handleWalletImportKeys(); handleWalletImportKeys();
@ -221,7 +221,6 @@ function Settings_ShowCoinPeers() {
type: 'POST', type: 'POST',
data: JSON.stringify(ajax_data), data: JSON.stringify(ajax_data),
url: 'http://127.0.0.1:7778', url: 'http://127.0.0.1:7778',
//dataType: 'text',
success: function(data, textStatus, jqXHR) { success: function(data, textStatus, jqXHR) {
var getCoinPeers = JSON.parse(data); var getCoinPeers = JSON.parse(data);
console.log(getCoinPeers); console.log(getCoinPeers);
@ -270,12 +269,10 @@ function Settings_ShowCoinPeers() {
}); });
} }
function Settings_AddCoinPeers() { function Settings_AddCoinPeers() {
console.log('wait till peer ip added to selected coin...') console.log('wait till peer ip added to selected coin...')
var settings_selected_coinname_code_val = $('option:selected', '#settings_select_coin_addpeer_options').val(), 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'), tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
ajax_data = { ajax_data = {
'userpass': tmpIguanaRPCAuth, 'userpass': tmpIguanaRPCAuth,
@ -289,7 +286,6 @@ function Settings_AddCoinPeers() {
type: 'POST', type: 'POST',
data: JSON.stringify(ajax_data), data: JSON.stringify(ajax_data),
url: 'http://127.0.0.1:7778', url: 'http://127.0.0.1:7778',
//dataType: 'text',
success: function(data, textStatus, jqXHR) { success: function(data, textStatus, jqXHR) {
var getAddCoinPeers = JSON.parse(data); var getAddCoinPeers = JSON.parse(data);
console.log(getAddCoinPeers); console.log(getAddCoinPeers);
@ -322,9 +318,8 @@ function Settings_LoadDebugLog() {
type: 'POST', type: 'POST',
data: ajax_data, data: ajax_data,
url: 'http://127.0.0.1:17777/shepherd/debuglog', url: 'http://127.0.0.1:17777/shepherd/debuglog',
//dataType: 'text',
success: function(data, textStatus, jqXHR) { 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); console.log(data);
}, },
error: function(xhr, textStatus, error) { error: function(xhr, textStatus, error) {

Loading…
Cancel
Save