You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
103 lines
4.2 KiB
103 lines
4.2 KiB
// DOM Ready =============================================================
|
|
$(document).ready(function() {
|
|
|
|
});
|
|
|
|
// Functions =============================================================
|
|
|
|
function Settings_ShowWalletInfo() {
|
|
var CheckLoginData = JSON.parse(sessionStorage.getItem('IguanaActiveAccount'));
|
|
console.log(JSON.parse(CheckLoginData));
|
|
$("#winfo_pubkey_value").text(JSON.parse(CheckLoginData).pubkey);
|
|
$("#winfo_btcpubkey_value").text(JSON.parse(CheckLoginData).btcpubkey);
|
|
$("#winfo_rmd160_value").text(JSON.parse(CheckLoginData).rmd160);
|
|
$("#winfo_NXT_value").text(JSON.parse(CheckLoginData).NXT);
|
|
$("#winfo_notary_value").text(JSON.parse(CheckLoginData).notary);
|
|
$("#winfo_status_value").text(JSON.parse(CheckLoginData).status);
|
|
//$("#winfo_duration_value").text(JSON.parse(CheckLoginData).duration);
|
|
}
|
|
|
|
function Settings_ShowCoinPeers() {
|
|
console.log('waiting getpeers api to complete...');
|
|
$("#coin_supernetpeers_h").text('');
|
|
$("#coin_supernetpeers").text('');
|
|
$("#coin_rawpeers_h").text('');
|
|
$("#coin_rawpeers").text('');
|
|
var settings_selected_coinname_code_val = $("option:selected","#settings_select_coin_options").val();
|
|
var ajax_data = {"agent":"SuperNET","method":"getpeers","activecoin": settings_selected_coinname_code_val};
|
|
$.ajax({
|
|
type: 'POST',
|
|
data: JSON.stringify(ajax_data),
|
|
url: 'http://127.0.0.1:7778',
|
|
//dataType: 'text',
|
|
success: function(data, textStatus, jqXHR) {
|
|
var getCoinPeers = JSON.parse(data);
|
|
console.log(getCoinPeers);
|
|
|
|
if (getCoinPeers.supernet[0].peers !== undefined ) {
|
|
var supernet_peers_list = getCoinPeers.supernet[0].peers;
|
|
if (supernet_peers_list != 0 ) {
|
|
$("#coin_supernetpeers_h").text(getCoinPeers.supernet[0].coin);
|
|
$.each(supernet_peers_list, function( index, value ) {
|
|
var br_val = "";
|
|
if ( index != 0 ) { br_val = "<br>" }
|
|
$("#coin_supernetpeers").append(br_val+value);
|
|
});
|
|
}
|
|
}
|
|
|
|
if (getCoinPeers.rawpeers[0].peers !== undefined ) {
|
|
var raw_peers_list = getCoinPeers.rawpeers[0].peers;
|
|
if (raw_peers_list != 0 ) {
|
|
$("#coin_rawpeers_h").text(getCoinPeers.supernet[0].coin);
|
|
$.each(raw_peers_list, function( index, value ) {
|
|
var br_val = "";
|
|
if ( index != 0 ) { br_val = "<br>" }
|
|
$("#coin_rawpeers").append(br_val+value);
|
|
});
|
|
}
|
|
}
|
|
},
|
|
error: function(xhr, textStatus, error) {
|
|
console.log('failed getting Coin History.');
|
|
console.log(xhr.statusText);
|
|
if ( xhr.readyState == 0 ) {
|
|
Iguana_ServiceUnavailable();
|
|
}
|
|
console.log(textStatus);
|
|
console.log(error);
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
|
|
function Settings_AddCoinPeers() {
|
|
console.log("wait till peer ip added to selected coin...")
|
|
var settings_selected_coinname_code_val = $("option:selected","#settings_select_coin_addpeer_options").val();
|
|
var settings_add_peer_ip_val = $("#settings_add_peer_ip").val();
|
|
var ajax_data = {"agent":"iguana","method":"addnode","activecoin": settings_selected_coinname_code_val,"ipaddr": settings_add_peer_ip_val};
|
|
$.ajax({
|
|
type: 'POST',
|
|
data: JSON.stringify(ajax_data),
|
|
url: 'http://127.0.0.1:7778',
|
|
//dataType: 'text',
|
|
success: function(data, textStatus, jqXHR) {
|
|
var getAddCoinPeers = JSON.parse(data);
|
|
console.log(getAddCoinPeers);
|
|
if ( getAddCoinPeers.result == 'addnode submitted' ) {
|
|
toastr.success(settings_add_peer_ip_val + " added to " + settings_selected_coinname_code_val + " Successfully", "Coin Notification");
|
|
$("#settings_add_peer_ip").val('');
|
|
}
|
|
},
|
|
error: function(xhr, textStatus, error) {
|
|
console.log('failed getting Coin History.');
|
|
console.log(xhr.statusText);
|
|
if ( xhr.readyState == 0 ) {
|
|
Iguana_ServiceUnavailable();
|
|
}
|
|
console.log(textStatus);
|
|
console.log(error);
|
|
}
|
|
});
|
|
}
|