Browse Source

Activated section: Wallet Settings to export active coin keys

master
Satinder Grewal 8 years ago
parent
commit
cc08ce455f
  1. 31
      assets/scripts/sidebar.js
  2. 155
      assets/scripts/walletsettings.js
  3. 20
      index.html

31
assets/scripts/sidebar.js

@ -17,8 +17,7 @@ $(document).ready(function() {
$('#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");
sessionStorage.setItem('DashboardActions', "start"); CommonSidebarActionsSet01();
$(document).ready(function() { Dashboard.init(); });
}); });
@ -39,8 +38,7 @@ $('#nav-dashboard').on('click', function() {
$('#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");
sessionStorage.setItem('DashboardActions', "start"); CommonSidebarActionsSet01();
$(document).ready(function() { Dashboard.init(); });
}); });
$('#nav-easydex').on('click', function() { $('#nav-easydex').on('click', function() {
@ -60,7 +58,7 @@ $('#nav-easydex').on('click', function() {
$('#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");
sessionStorage.setItem('DashboardActions', "stop"); CommonSidebarActionsSet02();
}); });
$('#nav-komodo-wallet').on('click', function() { $('#nav-komodo-wallet').on('click', function() {
@ -80,7 +78,7 @@ $('#nav-komodo-wallet').on('click', function() {
$('#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("Komodo Wallet"); $(".header-easydex-section").text("Komodo Wallet");
sessionStorage.setItem('DashboardActions', "stop"); CommonSidebarActionsSet02();
}); });
$('#nav-zcash-wallet').on('click', function() { $('#nav-zcash-wallet').on('click', function() {
@ -100,7 +98,7 @@ $('#nav-zcash-wallet').on('click', function() {
$('#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");
sessionStorage.setItem('DashboardActions', "stop"); CommonSidebarActionsSet02();
}); });
$('#nav-iguana-atomic-explorer').on('click', function() { $('#nav-iguana-atomic-explorer').on('click', function() {
@ -120,7 +118,7 @@ $('#nav-iguana-atomic-explorer').on('click', function() {
$('#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");
sessionStorage.setItem('DashboardActions', "stop"); CommonSidebarActionsSet02();
}); });
$('#nav-iguana-wallet-settings').on('click', function() { $('#nav-iguana-wallet-settings').on('click', function() {
@ -141,7 +139,7 @@ $('#nav-iguana-wallet-settings').on('click', function() {
$('#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")
Settings_ShowWalletInfo(); //Execute this function from walletsettings.js file Settings_ShowWalletInfo(); //Execute this function from walletsettings.js file
sessionStorage.setItem('DashboardActions', "stop"); CommonSidebarActionsSet02();
}); });
$('#nav-about-iguana').on('click', function() { $('#nav-about-iguana').on('click', function() {
@ -161,6 +159,19 @@ $('#nav-about-iguana').on('click', function() {
$('#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");
sessionStorage.setItem('DashboardActions', "stop"); CommonSidebarActionsSet02();
}); });
function CommonSidebarActionSet01() {
sessionStorage.setItem('DashboardActions', "start");
$(document).ready(function() { Dashboard.init(); });
$("#wifkeys_passphrase").val('');
$('#wif-priv-keys').html('');
}
function CommonSidebarActionsSet02() {
sessionStorage.setItem('DashboardActions', "stop");
$("#wifkeys_passphrase").val('');
$('#wif-priv-keys').html('');
}

155
assets/scripts/walletsettings.js

@ -1,6 +1,155 @@
var WalletSettings = function() {
var handleWalletExportKeys = function() {
$('.wifkeys-form').validate({
//errorElement: 'span', //default input error message container
//errorClass: 'help-block', // default input error message class
//focusInvalid: false, // do not focus the last invalid input
rules: {
wifkeys_passphrase: {
required: true
}
},
messages: {
wifkeys_passphrase: {
required: "Passphrase is required."
}
},
submitHandler: function(form) {
console.log("wait till peer ip added to selected coin...")
var Getwifkeys_passphrase = $("#wifkeys_passphrase").val();
var WifKeyDivContent = '';
//First check which coins are active. Execute API for each mode of wallet
$.each([ 'basilisk', 'full', 'virtual' ], function( index, value ) {
var allcoins_ajax_data = {"agent":"InstantDEX","method":"allcoins"};
$.ajax({
type: 'POST',
data: JSON.stringify(allcoins_ajax_data),
url: 'http://127.0.0.1:7778',
//dataType: 'text',
success: function(data, textStatus, jqXHR) {
var AllcoinsDataOutput = JSON.parse(data);
//Only execute further code if that mode has any coins active it. if none, skill checking on them.
if (AllcoinsDataOutput[value].length !== 0 ) {
console.log('== AllCoins Data OutPut ==');
console.log(value);
console.log(AllcoinsDataOutput[value]);
//First Run Encryptwallet API to get wif keys for each active coin
$.each(AllcoinsDataOutput[value], function(index) {
var wifkey_coin_handle = AllcoinsDataOutput[value][index];
console.log(AllcoinsDataOutput[value][index]);
var EncryptWallet_ajax_data = {"agent":"bitcoinrpc","method":"encryptwallet","passphrase":Getwifkeys_passphrase}
$.ajax({
type: 'POST',
data: JSON.stringify(EncryptWallet_ajax_data),
url: 'http://127.0.0.1:7778',
//dataType: 'text',
success: function(data, textStatus, jqXHR) {
var EncryptWalletDataOutput = JSON.parse(data);
console.log(EncryptWalletDataOutput[wifkey_coin_handle+'wif']);
WifKeyDivContent += '<table class="table">';
WifKeyDivContent += '<tr><td style="width: 5%;"><b>'+wifkey_coin_handle+'</b></td><td>'+EncryptWalletDataOutput[wifkey_coin_handle]+'</td></tr>';
WifKeyDivContent += '<tr><td><b>'+wifkey_coin_handle+'Wif</b></td><td>'+EncryptWalletDataOutput[wifkey_coin_handle+'wif']+'</td></tr>';
WifKeyDivContent += '</table>';
$('#wif-priv-keys').html(WifKeyDivContent);
},
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);
}
});
});
//Second run walletpassphrase again to make sure wallet is unlocked as before login.
var WalletPassphrase_ajax_data = {"agent":"bitcoinrpc","method":"walletpassphrase","password":Getwifkeys_passphrase,'timeout': '2592000'}
$.ajax({
type: 'POST',
data: JSON.stringify(WalletPassphrase_ajax_data),
url: 'http://127.0.0.1:7778',
//dataType: 'text',
success: function(data, textStatus, jqXHR) {
var WalletPassphraseDataOutput = JSON.parse(data);
console.log(WalletPassphraseDataOutput);
},
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);
}
});
}
},
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);
}
});
});
}
});
$('.wifkeys-form input').keypress(function(e) {
if (e.which == 13) {
if ($('.wifkeys-form').validate().form()) {
$('.wifkeys-form').submit(); //form validation success, call ajax form submit
}
return false;
}
});
};
return {
//main function to initiate the module
init: function() {
handleWalletExportKeys();
}
};
}();
jQuery(document).ready(function() {
WalletSettings.init();
});
// DOM Ready ============================================================= // DOM Ready =============================================================
$(document).ready(function() { $(document).ready(function() {
/*$('#settings_getcoinpeers_btn').click(function() { Settings_ExportActiveCoinKeys(); });
$('.wifkeys-form input').keypress(function(e) {
console.log('something happened with wifkeys...');
if (e.which == 13) {
if ($('.wifkeys-form').validate().form()) {
$('.wifkeys-form').submit(); //form validation success, call ajax form submit
}
return false;
}
});*/
}); });
// Functions ============================================================= // Functions =============================================================
@ -100,4 +249,8 @@ function Settings_AddCoinPeers() {
console.log(error); console.log(error);
} }
}); });
}
function Settings_ExportActiveCoinKeys() {
} }

20
index.html

@ -779,7 +779,25 @@
Wallet Backup section to be updated soon. Wallet Backup section to be updated soon.
</div> </div>
<div class="tab-pane" id="GetPrivKey" role="tabpanel"> <div class="tab-pane" id="GetPrivKey" role="tabpanel">
Export Keys section to be updated soon. <p>Only the active coin wallet wif keys will be shown here.<br>
If you don't see a wif key for the coin you are looking for please active it by adding it from EasyDEX Dashboard.<br>
You can use these wif keys to import to another coin wallets. <b><i>Please keep these keys extra safe and secure.</i></b></p>
<div class="col-sm-12"></div>
<form class="wifkeys-form" method="post" action="javascript:;" autocomplete="off" onsubmit="return false;">
<div class="form-group form-material floating">
<input type="password" class="form-control" name="wifkeys_passphrase" id="wifkeys_passphrase">
<label class="floating-label" for="wifkeys_passphrase">Passphrase</label>
</div>
<div class="col-sm-12 col-xs-12" style="text-align: center;">
<button type="submit" class="btn btn-primary waves-effect waves-light" data-toggle="modal" data-dismiss="modal" id="settings_getcoinpeers_btn">Get Wif Keys</button>
</div>
</form>
<div class="col-sm-12" style="padding-top: 15px;">
<div class="row" id="wif-priv-keys" data-plugin="masonry">
</div>
</div>
</div> </div>
<div class="tab-pane" id="FiatCurrencySettings" role="tabpanel"> <div class="tab-pane" id="FiatCurrencySettings" role="tabpanel">
Fiat currency settings section to be updated soon. Fiat currency settings section to be updated soon.

Loading…
Cancel
Save