Browse Source

multilang #2 (wip)

master
Petr Balashov 8 years ago
parent
commit
e43ae365bc
  1. 6
      assets/scripts/atomicexplorer.js
  2. 43
      assets/scripts/coinwallets.js
  3. 550
      assets/scripts/dashboard.js
  4. 1378
      assets/scripts/iguana_api.js
  5. 81
      assets/scripts/kmd_wallet_dashboard.js
  6. 92
      assets/scripts/lang/en.js
  7. 63
      assets/scripts/login.js
  8. 85
      index.html

6
assets/scripts/atomicexplorer.js

@ -11,7 +11,7 @@ var AtomicExplorer = function() {
'hideEasing': 'linear',
'showMethod': 'fadeIn',
'hideMethod': 'fadeOut'
}
};
var handleExplorer = function() {
$('#atomic_explorer_getcoinpeers_btn').click(function() {
@ -23,7 +23,7 @@ var AtomicExplorer = function() {
'</div>'
});
NProgress.start();
console.log("button pushed in atomic explorer");
console.log('button pushed in atomic explorer');
var atomic_explorer_select_coin_val = $('select[id=\'atomic_explorer_select_coin_options\']').val(),
atomic_explorer_select_command_val = $('select[id=\'atomic_explorer_select_command_options\']').val(),
@ -326,7 +326,7 @@ var AtomicExplorer = function() {
}
if (ExplorerOutputData.error === 'less than required responses') {
toastr.error('Less than required responses. Please try again.', 'Basilisk Notification')
toastr.error(_lang[defaultLang].DASHBOARD.LESS_RESPONSES_REQ, _lang[defaultLang].DASHBOARD.BASILISC_NOTIFICATION)
}
NProgress.done();

43
assets/scripts/coinwallets.js

@ -46,6 +46,7 @@ function sendCurrency(val) {
'agent': 'bitcoinrpc',
'method': 'getinfo'
};
$.ajax({
type: 'POST',
data: JSON.stringify(getinfoValues),
@ -65,7 +66,6 @@ function sendCurrency(val) {
console.log(error);
}
});
}
function ReceiveCurrency(rec_val) {
@ -87,12 +87,12 @@ function ReceiveCurrency(rec_val) {
}
var clipboard = new Clipboard('.btn');
clipboard.on('success', function(e) {
console.log(e);
});
clipboard.on('error', function(e) {
console.log(e);
});
clipboard.on('success', function(e) {
console.log(e);
});
clipboard.on('error', function(e) {
console.log(e);
});
}
$('#mdl_currency_amount').keyup(function() {
@ -115,7 +115,7 @@ $('#mdl_currency_amount').keyup(function() {
//console.log($('#mdl_currency_amount').val());
//console.log(total_of_currency_fiat);
$('#mdl_currency_total_value').text(total_of_currency_fee.toFixed(8));
$('#mdl_currency_total_fiat_value').text(fiat_symbol+total_of_currency_fiat.toFixed(2));
$('#mdl_currency_total_fiat_value').text(fiat_symbol + total_of_currency_fiat.toFixed(2));
if ($('#mdl_currency_amount').val() != '' && $('#mdl_currency_sendto') != '' && $('#mdl_currency_fee') != '' ) {
mdl_send_btn.removeClass('disabled');
@ -225,17 +225,16 @@ function ExecuteSendCurrencyAPI() {
console.log('== Data OutPut ==');
console.log(SendToAddrData);
if ( SendToAddrData.error != 'couldnt create rawtx' ) {
SendToAddrTxDataTitle = 'Transaction Failed';
SendToAddrTxDataTitle = _lang[defaultLang].COIN_WALLETS.TX_FAILED;
}
if ( SendToAddrData.sendrawtransaction == 'success' ) {
SendToAddrTxDataTitle = 'Transaction Successful';
SendToAddrTxDataTitle = _lang[defaultLang].COIN_WALLETS.TX_SUCCESS;
}
var SentToAddrTxData = '<font style="font-size: 13px; font-family: Menlo,Monaco,Consolas,Courier New,monospace">' +
'<font style="font-weight: 800">' +
'<b>Transaction ID:</b>'
'<b>' + _lang[defaultLang].COIN_WALLETS.TX + ' ID:</b>'
'</font>' +
SendToAddrData.result +
'</font>';
@ -245,7 +244,7 @@ function ExecuteSendCurrencyAPI() {
});
if ( SendToAddrData.sendrawtransaction == 'success' ) {
toastr.success('Transaction Sent', 'Transaction Notification')
toastr.success(_lang[defaultLang].TOASTR.TX_SENT, _lang[defaultLang].TOASTR.TX_NOTIFICATION);
}
},
error: function(xhr, textStatus, error) {
@ -253,7 +252,7 @@ function ExecuteSendCurrencyAPI() {
console.log(xhr.statusText);
console.log(textStatus);
console.log(error);
toastr.error('Unable to complete transaction', 'Transaction Notification')
toastr.error(_lang[defaultLang].TOASTR.TX_SEND_ERR, _lang[defaultLang].TOASTR.TX_NOTIFICATION);
}
});
@ -288,14 +287,14 @@ function WalletFiatCurrency(fiat_currency_value) {
function Iguana_rmd160conv(rmd160conv_data) {
// comment
var tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth');
var ajax_data = {
'userpass': tmpIguanaRPCAuth,
'agent': 'SuperNET',
'method': 'rmd160conv',
'rmd160': rmd160conv_data.rmd160,
'coin': rmd160conv_data.coin
};
var tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
ajax_data = {
'userpass': tmpIguanaRPCAuth,
'agent': 'SuperNET',
'method': 'rmd160conv',
'rmd160': rmd160conv_data.rmd160,
'coin': rmd160conv_data.coin
};
console.log(ajax_data);
$.ajax({

550
assets/scripts/dashboard.js

@ -154,12 +154,11 @@ var Dashboard = function() {
edexcoin_addr_list_with_balance = result
console.log(edexcoin_addr_list_with_balance);
var tmpoptions = '';
tmpoptions += '<option> <span data-lang="DASHBOARD.SELECT_ADDRESS"></span> </option>';
tmpoptions += '<option> ' + _lang[defaultLang].DASHBOARD.SELECT_ADDRESS +' </option>';
$.each(edexcoin_addr_list_with_balance, function(index) {
tmpoptions += '<option value="' + edexcoin_addr_list_with_balance[index].addr + '" data-total="' + edexcoin_addr_list_with_balance[index].total + '">[ ' + edexcoin_addr_list_with_balance[index].total + ' KMD ] &emsp;' + edexcoin_addr_list_with_balance[index].addr + '</option>';
$('#edexcoin_send_from').html(tmpoptions);
});
lang();
$('.showedexcoinaddrs').selectpicker({ style: 'btn-info' });
$('.showedexcoinaddrs').selectpicker('refresh');
@ -188,7 +187,7 @@ var Dashboard = function() {
});
$('#edexcoin_send_from').change(function() {
if ($('#edexcoin_send_from').val() !== '' || $('#edexcoin_send_from').val() !== '- Select Address -') {
if ($('#edexcoin_send_from').val() !== '' || $('#edexcoin_send_from').val() !== _lang[defaultLang].DASHBOARD.SELECT_ADDRESS) {
$('.edexcoin_send_coins_btn_step1').removeClass('disabled');
$('.edexcoin_send_coins_btn_step1').prop('disabled', false);
@ -201,16 +200,20 @@ var Dashboard = function() {
if (!('refresh' in query[active_edexcoin][coin_addr])) {
console.log(active_edexcoin + '>>>' + coin_addr + ' => refresh not found.')
var call_data = {"allcoins": false,"coin":active_edexcoin,"calls":"refresh"}
Shepherd_FetchBasiliskData(call_data).then(function(result){
console.log(result)
})
var call_data = {
'allcoins': false,
'coin': active_edexcoin,
'calls': 'refresh'
};
Shepherd_FetchBasiliskData(call_data).then(function(result) {
console.log(result);
});
} else {
console.log(query[active_edexcoin][coin_addr].refresh.status)
console.log(query[active_edexcoin][coin_addr].refresh.status);
}
})
}
if ($('#edexcoin_send_from').val() === '' || $('#edexcoin_send_from').val() === '- Select Address -') {
if ($('#edexcoin_send_from').val() === '' || $('#edexcoin_send_from').val() === _lang[defaultLang].DASHBOARD.SELECT_ADDRESS) {
$('.edexcoin_send_coins_btn_step1').addClass(' disabled');
$('.edexcoin_send_coins_btn_step1').prop('disabled', true);
}
@ -233,8 +236,6 @@ var Dashboard = function() {
//console.log($('#edexcoin_amount').val());
$('#edexcoin_total_value').text(total_minus_currency_fee.toFixed(8));
});
edexcoin_send_form_validator = $('.edexcoin-send-form').validate({
@ -261,19 +262,19 @@ var Dashboard = function() {
messages: {
edexcoin_send_from: {
required: 'From Address is required.'
required: _lang[defaultLang].DASHBOARD.SEND_FROMADDR_REQ
},
edexcoin_sendto: {
required: 'To Address is required.'
required: _lang[defaultLang].DASHBOARD.SEND_TOADDR_REQ
},
edexcoin_amount: {
required: 'Please enter amount to send.'
required: _lang[defaultLang].DASHBOARD.SEND_AMOUNT_REQ
},
edexcoin_fee: {
required: 'Make sure you have fee entered. Default value is 0.0001.'
required: _lang[defaultLang].DASHBOARD.SEND_FEE_REQ + ' 0.0001.'
},
edexcoin_total_value: {
required: 'Make sure you have both amount and fee entered to calculate final total.'
required: _lang[defaultLang].DASHBOARD.SEND_TOTAL_REQ
}
},
@ -318,6 +319,7 @@ var Dashboard = function() {
tmp_send_from_addr = $('#edexcoin_send_from').val()
tmp_send_to_addr = $('#edexcoin_sendto').val(),
tmp_send_total_amount = $('#edexcoin_total_value').text();
$('#edexcoin-send-screen').hide();
$('#edexcoin-send-confirm-screen').show();
$('#edexcoin_send_step_1').removeClass( 'current' ).addClass( '' );
@ -334,9 +336,10 @@ var Dashboard = function() {
var active_edexcoin = $('[data-edexcoin]').attr('data-edexcoin'),
tmp_send_from_addr = $('#edexcoin_send_from').val()
tmp_send_to_addr = $('#edexcoin_sendto').val(),
tmp_send_total_amount = $('#edexcoin_total_value').text();
tmp_send_fee = $('#edexcoin_fee').val()
tmp_sendflag = $('#edexcoin_send_sig').is(":checked")
tmp_send_total_amount = $('#edexcoin_total_value').text(),
tmp_send_fee = $('#edexcoin_fee').val(),
tmp_sendflag = $('#edexcoin_send_sig').is(":checked");
console.log(active_edexcoin);
console.log(tmp_send_from_addr);
console.log(tmp_send_to_addr);
@ -346,8 +349,8 @@ var Dashboard = function() {
var edexcoin_sendto_result_tbl = '';
edexcoin_sendto_result_tbl += '<tr class="info">' +
'<td>Info</td>' +
'<td>The transaction submitted is processing. Once processed the transaction details will be displayed here.</td>' +
'<td>' + _lang[defaultLang].INDEX.INFO + '</td>' +
'<td>' + _lang[defaultLang].DASHBOARD.SEND_TX_PROGRESS + '</td>' +
'</tr>';
$('#edexcoin_sendto_result tbody').html(edexcoin_sendto_result_tbl);
$('#edexcoin_send_coins_anothertx_btn').hide();
@ -445,7 +448,7 @@ var Dashboard = function() {
var active_edexcoin = $('[data-edexcoin]').attr('data-edexcoin');
console.log('get new T address button clicked...');
EdexListAllAddr(active_edexcoin);
toastr.info('Receiving Address list updated', 'Wallet Notification');
toastr.info(_lang[defaultLang].TOASTR.RECADDR_UPDATED, _lang[defaultLang].TOASTR.WALLET_NOTIFICATION);
});
};
@ -612,8 +615,8 @@ var Dashboard = function() {
walletDivContent += '<!-- End Wallet Widget ' + AllcoinsDataOutput[value][index] + ' -->';
$('.wallet-widgets-row').html(walletDivContent);
$('.scrollbar-dynamic').scrollbar(); //Make sure widget-body has scrollbar for transactions history
$('[data-toggle="tooltip"]').tooltip(); //Make sure tooltips are working for wallet widgets and anywhere else in wallet.
$('.scrollbar-dynamic').scrollbar(); // Make sure widget-body has scrollbar for transactions history
$('[data-toggle="tooltip"]').tooltip(); // Make sure tooltips are working for wallet widgets and anywhere else in wallet.
edexCoinBtnAction();
});
},
@ -626,7 +629,7 @@ var Dashboard = function() {
console.log(textStatus);
console.log(error);
if (xhr.readyState == '0' ) {
toastr.error('Unable to connect to Iguana', 'Account Notification');
toastr.error(_lang[defaultLang].TOASTR.IGUANA_CONN_ERR, _lang[defaultLang].TOASTR.ACCOUNT_NOTIFICATION);
}
}
});
@ -694,17 +697,21 @@ var Dashboard = function() {
$('.btn_edexcoin_dashboard_fetchdata').click(function() {
var selected_coin = $(this).data('edexcoin');
Shepherd_CheckBasiliskCacheData(selected_coin).then(function(result){
console.log(result)
console.log(result.coin)
var call_data = {"allcoins": false,"coin":selected_coin,"calls":"listtransactions:getbalance"}
console.log(call_data)
Shepherd_CheckBasiliskCacheData(selected_coin).then(function(result) {
console.log(result);
console.log(result.coin);
var call_data = {
'allcoins': false,
'coin': selected_coin,
'calls': 'listtransactions:getbalance'
};
console.log(call_data);
Shepherd_FetchBasiliskData(call_data).then(function(result){
console.log(result)
toastr.info('Fetching Data. Please wait for a minute to complete this task.', 'Basilisk Notification');
})
})
Shepherd_FetchBasiliskData(call_data).then(function(result) {
console.log(result);
toastr.info(_lang[defaultLang].TOASTR.FETCHING_DATA, _lang[defaultLang].TOASTR.BASILISK_NOTIFICATION);
});
});
});
$('.btn_edexcoin_dashboard_refresh_basilisk_conn').click(function() {
@ -789,19 +796,23 @@ var Dashboard = function() {
var FetchBasiliskData = setInterval(function() {
var active_edexcoin = $('[data-edexcoin]').attr('data-edexcoin'),
active_edexcoinmodecode = sessionStorage.getItem('edexTmpMode');
active_edexcoinmodecode = sessionStorage.getItem('edexTmpMode');
// TODO: refactor
if ( sessionStorage.getItem('IguanaActiveAccount') === null ) {
//clearInterval(FetchBasiliskData);
//console.log('=> No wallet logged in, or Dashboard not ative. No need to Run History.');
} else {
if ( active_edexcoinmodecode == 'Basilisk') {
var call_data = {"allcoins": false,"coin":active_edexcoin,"calls":"listtransactions:getbalance"}
var call_data = {
'allcoins': false,
'coin': active_edexcoin,
'calls': 'listtransactions:getbalance'
};
//console.log(call_data)
if ( sessionStorage.getItem('edexTmpRefresh') === null || sessionStorage.getItem('edexTmpRefresh') === 'start') {
Shepherd_FetchBasiliskData(call_data).then(function(result){
console.log(result)
})
Shepherd_FetchBasiliskData(call_data).then(function(result) {
console.log(result);
});
}
}
}
@ -1381,7 +1392,7 @@ function getDEXGetBalance2(coin) {
ajax_call_2.done(function(data) {
console.log(data);
if (data.error === 'less than required responses') {
toastr.error('Less than required responses. Please try again.', 'Basilisk Notification');
toastr.error(_lang[defaultLang].TOASTR.LESS_RESPONSES_REQ, _lang[defaultLang].BASILISK_NOTIFICATION);
}
var tmpcalcnum = 0,
@ -1673,7 +1684,7 @@ function refreshEDEXCoinWalletList() {
console.log(error);
if (xhr.readyState == '0' ) {
toastr.error('Unable to connect to Iguana', 'Account Notification');
toastr.error(_lang[defaultLang].TOASTR.IGUANA_CONN_ERR, _lang[defaultLang].TOASTR.ACCOUNT_NOTIFICATION);
}
}
});
@ -1723,7 +1734,7 @@ function SwitchBasicliskFull(switch_data) {
if (SwitchCoinDataOutput.result === 'coin added') {
console.log('coin added');
toastr.success(switch_data.currency + ' switched to ' + mode_value + ' Mode', 'Coin Notification');
toastr.success(switch_data.currency + ' ' + _lang[defaultLang].TOASTR.SWITCHED_TO + ' ' + mode_value + ' ' + _lang[defaultLang].TOASTR.MODE, _lang[defaultLang].TOASTR.COIN_NOTIFICATION);
} else if (SwitchCoinDataOutput.result === 'coin already there') {
console.log('coin already there');
//toastr.info("Looks like" + switch_data.currency + "already running.", "Coin Notification");
@ -1741,7 +1752,7 @@ function SwitchBasicliskFull(switch_data) {
console.log(textStatus);
console.log(error);
if (xhr.readyState == '0' ) {
toastr.error('Unable to connect to Iguana', 'Account Notification');
toastr.error(_lang[defaultLang].TOASTR.IGUANA_CONN_ERR, _lang[defaultLang].TOASTR.ACCOUNT_NOTIFICATION);
}
}
});
@ -2015,12 +2026,12 @@ function EdexGetTxList(coin) {
tmp_amount = result_data[index].amount;
if (!('amount' in result_data[index])) {
tmp_amount = '<span class="label label-dark">Unknown</span>';
tmp_amount = '<span class="label label-dark">' + _lang[defaultLang].DASHBOARD.UNKNOWN + '</span>';
}
var tmp_addr = result_data[index].address;
if (!('address' in result_data[index])) {
tmp_addr = '<i class="icon fa-bullseye"></i> <span class="label label-dark">Z Address not listed by wallet!</span>';
tmp_addr = '<i class="icon fa-bullseye"></i> <span class="label label-dark">' + _lang[defaultLang].DASHBOARD.ZADDR_NOT_LISTED + '!</span>';
}
var tmp_secondsToString = secondsToString(result_data[index].blocktime);
@ -2071,12 +2082,12 @@ function EdexGetTxList(coin) {
tmp_amount = result_data[index].amount;
if (!('amount' in result_data[index])) {
tmp_amount = '<span class="label label-dark">Unknown</span>';
tmp_amount = '<span class="label label-dark">' + _lang[defaultLang].DASHBOARD.UNKNOWN + '</span>';
}
var tmp_addr = null
if (!('paid' in result_data[index])) {
tmp_addr = '<i class="icon fa-bullseye"></i> <span class="label label-dark">Z Address not listed by wallet!</span>';
tmp_addr = '<i class="icon fa-bullseye"></i> <span class="label label-dark">' + _lang[defaultLang].DASHBOARD.ZADDR_NOT_LISTED + '!</span>';
}
if (('paid' in result_data[index])) {
var first_addr = Object.keys(result_data[index].paid['vouts'][0]),
@ -2086,23 +2097,23 @@ function EdexGetTxList(coin) {
var tmp_secondsToString = secondsToString(result_data[index].timestamp);
if ( result_data[index].type == 'sent' ) {
tmp_category = '<span class="label label-danger"><i class="icon fa-arrow-circle-left"></i> OUT</span>';
tmp_category = '<span class="label label-danger"><i class="icon fa-arrow-circle-left"></i> ' + _lang[defaultLang].DASHBOARD.OUT + '</span>';
}
if ( result_data[index].type == 'received' ) {
tmp_category = '<span class="label label-success"><i class="icon fa-arrow-circle-right"></i> IN</span>';
tmp_category = '<span class="label label-success"><i class="icon fa-arrow-circle-right"></i> ' + _lang[defaultLang].DASHBOARD.IN + '</span>';
}
if ( result_data[index].type == 'generate' ) {
tmp_category = '<i class="icon fa-cogs"></i> Mined';
tmp_category = '<i class="icon fa-cogs"></i> ' + _lang[defaultLang].DASHBOARD.MINED;
}
if ( result_data[index].type == 'immature' ) {
tmp_category = '<i class="icon fa-clock-o"></i> Immature';
tmp_category = '<i class="icon fa-clock-o"></i> ' + _lang[defaultLang].DASHBOARD.IMMATURE;
}
if ( result_data[index].type == 'unknown' ) {
tmp_category = '<i class="icon fa-meh-o"></i> Unknown';
tmp_category = '<i class="icon fa-meh-o"></i> ' + _lang[defaultLang].DASHBOARD.UNKNOWN;
}
if (!('confirmations' in result_data[index])) {
tmp_confirms = '<i class="icon fa-meh-o"></i> Unknown';
tmp_confirms = '<i class="icon fa-meh-o"></i> ' + _lang[defaultLang].DASHBOARD.UNKNOWN;
}
if (('confirmations' in result_data[index])) {
tmp_confirms = result_data[index].confirmations;
@ -2114,7 +2125,7 @@ function EdexGetTxList(coin) {
tmp_amount,
tmp_secondsToString,
tmp_addr,
'<button type="button" class="btn btn-xs white btn-info waves-effect waves-light kmd-txid-details-btn" data-edexcoin="' + coin + '" data-txidtype="public" data-txid="'+result_data[index].txid+'">' +
'<button type="button" class="btn btn-xs white btn-info waves-effect waves-light kmd-txid-details-btn" data-edexcoin="' + coin + '" data-txidtype="public" data-txid="' + result_data[index].txid + '">' +
'<i class="icon fa-search"></i>' +
'</button>'
];
@ -2163,12 +2174,12 @@ function EdexGetTxList_cache(coin) {
tmp_amount = result_data[index].amount;
if (!('amount' in result_data[index])) {
tmp_amount = '<span class="label label-dark">Unknown</span>';
tmp_amount = '<span class="label label-dark">' + _lang[defaultLang].DASHBOARD.UNKNOWN + '</span>';
}
var tmp_addr = null
if (!('paid' in result_data[index])) {
tmp_addr = '<i class="icon fa-bullseye"></i> <span class="label label-dark">Z Address not listed by wallet!</span>';
tmp_addr = '<i class="icon fa-bullseye"></i> <span class="label label-dark">' + _lang[defaultLang].DASHBOARD.ZADDR_NOT_LISTED + '!</span>';
}
if (('paid' in result_data[index])) {
var first_addr = Object.keys(result_data[index].paid['vouts'][0]),
@ -2178,23 +2189,23 @@ function EdexGetTxList_cache(coin) {
var tmp_secondsToString = secondsToString(result_data[index].timestamp);
if ( result_data[index].type == 'sent' ) {
tmp_category = '<span class="label label-danger"><i class="icon fa-arrow-circle-left"></i> OUT</span>';
tmp_category = '<span class="label label-danger"><i class="icon fa-arrow-circle-left"></i> ' + _lang[defaultLang].DASHBOARD.OUT + '</span>';
}
if ( result_data[index].type == 'received' ) {
tmp_category = '<span class="label label-success"><i class="icon fa-arrow-circle-right"></i> IN</span>';
tmp_category = '<span class="label label-success"><i class="icon fa-arrow-circle-right"></i> ' + _lang[defaultLang].DASHBOARD.IN + '</span>';
}
if ( result_data[index].type == 'generate' ) {
tmp_category = '<i class="icon fa-cogs"></i> Mined';
tmp_category = '<i class="icon fa-cogs"></i> ' + _lang[defaultLang].DASHBOARD.MINED;
}
if ( result_data[index].type == 'immature' ) {
tmp_category = '<i class="icon fa-clock-o"></i> Immature';
tmp_category = '<i class="icon fa-clock-o"></i> ' + _lang[defaultLang].DASHBOARD.IMMATURE;
}
if ( result_data[index].type == 'unknown' ) {
tmp_category = '<i class="icon fa-meh-o"></i> Unknown';
tmp_category = '<i class="icon fa-meh-o"></i> ' + _lang[defaultLang].DASHBOARD.UNKNOWN;
}
if (!('confirmations' in result_data[index])) {
tmp_confirms = '<i class="icon fa-meh-o"></i> Unknown';
tmp_confirms = '<i class="icon fa-meh-o"></i> ' + _lang[defaultLang].DASHBOARD.UNKNOWN;
}
if (('confirmations' in result_data[index])) {
tmp_confirms = result_data[index].confirmations;
@ -2565,196 +2576,227 @@ function EdexListAllAddr(coin) {
}
function ShowBasiliskFetchDataProgress(coin) {
var active_edexcoinmodecode = sessionStorage.getItem('edexTmpMode')
Shepherd_GetBasiliskCache().then(function(result){
var _data = JSON.parse(result)
var query = _data.result.basilisk
coin_exists = true
addresses_exists = true
getbalance_exists = true
listtransactions_exists = true
listunspent_exists = true
refresh_exists = true
getbalance_status = 'NOT FOUND'
listtransactions_status = 'NOT FOUND'
listunspent_status = 'NOT FOUND'
refresh_status = 'NOT FOUND'
//console.log(query)
if (!query) {
//console.log('data not found.')
res_data = {"coin":false, "addresses":false, "getbalance": false,"listtransactions": false,"listunspent": false,"refresh": false}
//console.log(res_data)
} else if (!query[coin]) {
//console.log(coin + ' not found.')
coin_exists = false
res_data = {"coin":coin_exists, "addresses":false, "getbalance": false,"listtransactions": false,"listunspent": false,"refresh": false}
//console.log(res_data)
} else if (!('addresses' in query[coin])) {
//console.log(coin + ' addresses not found.')
addresses_exists = false
res_data = {"coin":coin_exists, "addresses":false, "getbalance": false,"listtransactions": false,"listunspent": false,"refresh": false}
//console.log(res_data)
} else {
Promise.all(query[coin].addresses.map((coinaddr_value,coinaddr_index) => {
return new Promise((resolve, reject) => {
//console.log(coinaddr_index)
//console.log(coinaddr_value)
var data = query[coin][coinaddr_value].getbalance
//console.log(data)
if (!('getbalance' in query[coin][coinaddr_value])) {
//console.log(coin + '>>>' + coinaddr_value + ' => getbalance not found.')
getbalance_exists = false
} else {
//console.log(query[coin][coinaddr_value].getbalance.status)
getbalance_status = query[coin][coinaddr_value].getbalance.status
}
if (!('listtransactions' in query[coin][coinaddr_value])) {
//console.log(coin + '>>>' + coinaddr_value + ' => listtransactions not found.')
listtransactions_exists = false
} else {
//console.log(query[coin][coinaddr_value].listtransactions.status)
listtransactions_status = query[coin][coinaddr_value].listtransactions.status
}
if (!('listunspent' in query[coin][coinaddr_value])) {
//console.log(coin + '>>>' + coinaddr_value + ' => listunspent not found.')
listunspent_exists = false
} else {
//console.log(query[coin][coinaddr_value].listunspent.status)
listunspent_status = query[coin][coinaddr_value].listunspent.status
}
if (!('refresh' in query[coin][coinaddr_value])) {
//console.log(coin + '>>>' + coinaddr_value + ' => refresh not found.')
refresh_exists = false
} else {
//console.log(query[coin][coinaddr_value].refresh.status)
refresh_status = query[coin][coinaddr_value].refresh.status
}
pass_data = {
"addr_index":coinaddr_index,
"addr_value":coinaddr_value,
"getbalance": getbalance_exists,
"getbalance_status": getbalance_status,
"listtransactions": listtransactions_exists,
"listtransactions_status": listtransactions_status,
"listunspent": listunspent_exists,
"listunspent_status": listunspent_status,
"refresh": refresh_exists,
"refresh_status": refresh_status
}
resolve(pass_data)
})
})).then(result => {
//console.log(result)
//var res_data.coin = coin_exists
//var res_data.addresses = addresses_exists
var BasiliskFetchData = ''
$.each(result, function(result_index, result_val) {
//console.log(result_index)
//console.log(result_val)
var tmp_listunspent_lable_color = ''
var tmp_listtransactions_lable_color = ''
var tmp_getbalance_lable_color = ''
var tmp_refresh_lable_color = ''
switch (result_val.listunspent_status) {
case 'waiting':
tmp_listunspent_lable_color = 'dark'
break;
case 'in progress':
tmp_listunspent_lable_color = 'primary'
break;
case 'done':
tmp_listunspent_lable_color = 'success'
break;
case 'NOT FOUND':
tmp_listunspent_lable_color = 'danger'
break;
}
switch (result_val.listtransactions_status) {
case 'waiting':
tmp_listtransactions_lable_color = 'dark'
$('#edexcoin_dashboard_basilisk_refresh_status').show()
break;
case 'in progress':
tmp_listtransactions_lable_color = 'primary'
$('#edexcoin_dashboard_basilisk_refresh_status').show()
break;
case 'done':
tmp_listtransactions_lable_color = 'success'
$('#edexcoin_dashboard_basilisk_refresh_status').hide()
break;
case 'NOT FOUND':
tmp_listtransactions_lable_color = 'danger'
$('#edexcoin_dashboard_basilisk_refresh_status').show()
break;
}
switch (result_val.getbalance_status) {
case 'waiting':
tmp_getbalance_lable_color = 'dark'
$('#edexcoin_dashboard_basilisk_refresh_status').show()
break;
case 'in progress':
tmp_getbalance_lable_color = 'primary'
$('#edexcoin_dashboard_basilisk_refresh_status').show()
break;
case 'done':
tmp_getbalance_lable_color = 'success'
$('#edexcoin_dashboard_basilisk_refresh_status').hide()
break;
case 'NOT FOUND':
tmp_getbalance_lable_color = 'danger'
$('#edexcoin_dashboard_basilisk_refresh_status').show()
break;
}
switch (result_val.refresh_status) {
case 'waiting':
tmp_refresh_lable_color = 'dark'
$('#edexcoin_dashboard_basilisk_refresh_status').show()
break;
case 'in progress':
tmp_refresh_lable_color = 'primary'
$('#edexcoin_dashboard_basilisk_refresh_status').show()
break;
case 'done':
tmp_refresh_lable_color = 'success'
$('#edexcoin_dashboard_basilisk_refresh_status').hide()
break;
case 'NOT FOUND':
tmp_refresh_lable_color = 'danger'
//$('#edexcoin_dashboard_basilisk_refresh_status').show()
break;
}
BasiliskFetchData += '<tr>';
BasiliskFetchData += '<td>'+ result_val.addr_value.substring(0,5) +'...</td>';
BasiliskFetchData += '<td><span class="label label-'+tmp_listunspent_lable_color+' text-uppercase">'+result_val.listunspent_status+'</span></td>';
BasiliskFetchData += '<td><span class="label label-'+tmp_listtransactions_lable_color+' text-uppercase">'+result_val.listtransactions_status+'</span></td>';
BasiliskFetchData += '<td><span class="label label-'+tmp_getbalance_lable_color+' text-uppercase">'+result_val.getbalance_status+'</span></td>';
BasiliskFetchData += '<td><span class="label label-'+tmp_refresh_lable_color+' text-uppercase">'+result_val.refresh_status+'</span></td>';
BasiliskFetchData += '</tr>';
$('.tbl_edexcoin_dashboard_basilisk_refresh_status tbody').html(BasiliskFetchData);
//console.log(result_val.refresh_status)
/*if (result[result.length-1] == result_val && result_val.listtransactions_status !== 'done' && result_val.getbalance_status !== 'done' && result_val.refresh_status !== 'done' ) {
$('#edexcoin_dashboard_basilisk_refresh_status').show()
} else {
$('#edexcoin_dashboard_basilisk_refresh_status').hide()
}*/
})
})
}
var active_edexcoinmodecode = sessionStorage.getItem('edexTmpMode');
Shepherd_GetBasiliskCache().then(function(result) {
var _data = JSON.parse(result),
query = _data.result.basilisk,
coin_exists = true,
addresses_exists = true,
getbalance_exists = true,
listtransactions_exists = true,
listunspent_exists = true,
refresh_exists = true,
getbalance_status = 'NOT FOUND',
listtransactions_status = 'NOT FOUND',
listunspent_status = 'NOT FOUND',
refresh_status = 'NOT FOUND',
res_data;
//console.log(query)
if (!query) {
//console.log('data not found.')
res_data = {
'coin': false,
'addresses': false,
'getbalance': false,
'listtransactions': false,
'listunspent': false,
'refresh': false
};
//console.log(res_data)
} else if (!query[coin]) {
//console.log(coin + ' not found.')
coin_exists = false;
res_data = {
'coin': coin_exists,
'addresses': false,
'getbalance': false,
'listtransactions': false,
'listunspent': false,
'refresh': false
};
//console.log(res_data)
} else if (!('addresses' in query[coin])) {
//console.log(coin + ' addresses not found.')
addresses_exists = false;
res_data = {
'coin': coin_exists,
'addresses': false,
'getbalance': false,
'listtransactions': false,
'listunspent': false,
'refresh': false
};
//console.log(res_data)
} else {
Promise.all(query[coin].addresses.map((coinaddr_value,coinaddr_index) => {
return new Promise((resolve, reject) => {
//console.log(coinaddr_index)
//console.log(coinaddr_value)
var data = query[coin][coinaddr_value].getbalance;
//console.log(data)
if (!('getbalance' in query[coin][coinaddr_value])) {
//console.log(coin + '>>>' + coinaddr_value + ' => getbalance not found.')
getbalance_exists = false;
} else {
//console.log(query[coin][coinaddr_value].getbalance.status)
getbalance_status = query[coin][coinaddr_value].getbalance.status;
}
if (!('listtransactions' in query[coin][coinaddr_value])) {
//console.log(coin + '>>>' + coinaddr_value + ' => listtransactions not found.')
listtransactions_exists = false;
} else {
//console.log(query[coin][coinaddr_value].listtransactions.status)
listtransactions_status = query[coin][coinaddr_value].listtransactions.status;
}
if (!('listunspent' in query[coin][coinaddr_value])) {
//console.log(coin + '>>>' + coinaddr_value + ' => listunspent not found.')
listunspent_exists = false;
} else {
//console.log(query[coin][coinaddr_value].listunspent.status)
listunspent_status = query[coin][coinaddr_value].listunspent.status;
}
if (!('refresh' in query[coin][coinaddr_value])) {
//console.log(coin + '>>>' + coinaddr_value + ' => refresh not found.')
refresh_exists = false;
} else {
//console.log(query[coin][coinaddr_value].refresh.status)
refresh_status = query[coin][coinaddr_value].refresh.status;
}
pass_data = {
'addr_index': coinaddr_index,
'addr_value': coinaddr_value,
'getbalance': getbalance_exists,
'getbalance_status': getbalance_status,
'listtransactions': listtransactions_exists,
'listtransactions_status': listtransactions_status,
'listunspent': listunspent_exists,
'listunspent_status': listunspent_status,
'refresh': refresh_exists,
'refresh_status': refresh_status
};
resolve(pass_data);
});
}))
.then(result => {
//console.log(result);
//var res_data.coin = coin_exists;
//var res_data.addresses = addresses_exists;
var BasiliskFetchData = '';
$.each(result, function(result_index, result_val) {
//console.log(result_index);
//console.log(result_val);
var tmp_listunspent_lable_color = '',
tmp_listtransactions_lable_color = '',
tmp_getbalance_lable_color = '',
tmp_refresh_lable_color = '';
switch (result_val.listunspent_status) {
case 'waiting':
tmp_listunspent_lable_color = 'dark';
break;
case 'in progress':
tmp_listunspent_lable_color = 'primary';
break;
case 'done':
tmp_listunspent_lable_color = 'success';
break;
case 'NOT FOUND':
tmp_listunspent_lable_color = 'danger';
break;
}
switch (result_val.listtransactions_status) {
case 'waiting':
tmp_listtransactions_lable_color = 'dark';
$('#edexcoin_dashboard_basilisk_refresh_status').show();
break;
case 'in progress':
tmp_listtransactions_lable_color = 'primary';
$('#edexcoin_dashboard_basilisk_refresh_status').show();
break;
case 'done':
tmp_listtransactions_lable_color = 'success';
$('#edexcoin_dashboard_basilisk_refresh_status').hide();
break;
case 'NOT FOUND':
tmp_listtransactions_lable_color = 'danger';
$('#edexcoin_dashboard_basilisk_refresh_status').show();
break;
}
switch (result_val.getbalance_status) {
case 'waiting':
tmp_getbalance_lable_color = 'dark';
$('#edexcoin_dashboard_basilisk_refresh_status').show();
break;
case 'in progress':
tmp_getbalance_lable_color = 'primary';
$('#edexcoin_dashboard_basilisk_refresh_status').show();
break;
case 'done':
tmp_getbalance_lable_color = 'success';
$('#edexcoin_dashboard_basilisk_refresh_status').hide();
break;
case 'NOT FOUND':
tmp_getbalance_lable_color = 'danger';
$('#edexcoin_dashboard_basilisk_refresh_status').show();
break;
}
switch (result_val.refresh_status) {
case 'waiting':
tmp_refresh_lable_color = 'dark';
$('#edexcoin_dashboard_basilisk_refresh_status').show();
break;
case 'in progress':
tmp_refresh_lable_color = 'primary';
$('#edexcoin_dashboard_basilisk_refresh_status').show();
break;
case 'done':
tmp_refresh_lable_color = 'success';
$('#edexcoin_dashboard_basilisk_refresh_status').hide();
break;
case 'NOT FOUND':
tmp_refresh_lable_color = 'danger';
//$('#edexcoin_dashboard_basilisk_refresh_status').show();
break;
}
BasiliskFetchData += '<tr>';
BasiliskFetchData += '<td>' + result_val.addr_value.substring(0,5) + '...</td>';
BasiliskFetchData += '<td>' +
'<span class="label label-' + tmp_listunspent_lable_color + ' text-uppercase">' + result_val.listunspent_status + '</span>' +
'</td>';
BasiliskFetchData += '<td>' +
'<span class="label label-' + tmp_listtransactions_lable_color + ' text-uppercase">' + result_val.listtransactions_status + '</span>' +
'</td>';
BasiliskFetchData += '<td>' +
'<span class="label label-' + tmp_getbalance_lable_color + ' text-uppercase">' + result_val.getbalance_status + '</span>' +
'</td>';
BasiliskFetchData += '<td>' +
'<span class="label label-' + tmp_refresh_lable_color + ' text-uppercase">' + result_val.refresh_status + '</span>' +
'</td>';
BasiliskFetchData += '</tr>';
$('.tbl_edexcoin_dashboard_basilisk_refresh_status tbody').html(BasiliskFetchData);
//console.log(result_val.refresh_status)
/*if (result[result.length-1] == result_val && result_val.listtransactions_status !== 'done' && result_val.getbalance_status !== 'done' && result_val.refresh_status !== 'done' ) {
$('#edexcoin_dashboard_basilisk_refresh_status').show()
} else {
$('#edexcoin_dashboard_basilisk_refresh_status').hide()
}*/
});
});
}
});
}

1378
assets/scripts/iguana_api.js

File diff suppressed because it is too large

81
assets/scripts/kmd_wallet_dashboard.js

@ -42,7 +42,6 @@ var KMDWalletDashboard = function() {
$('#kmd_txid_info_hex').val(kmd_addr_txid_info[0].hex);
clearSendManyFieldData();
});
}
var handle_KMD_Send = function() {
@ -61,7 +60,7 @@ var KMDWalletDashboard = function() {
var kmd_addr_list_with_balance = KMDlistunspentT();
tmpoptions += '<option> - Select Transparent or Private Address - </option>';
tmpoptions += '<option> - ' + _lang[defaultLang].KMD_NATIVE.SELECT_ADDRESS + ' - </option>';
$.each(kmd_addr_list_with_balance, function(index) {
tmpoptions += '<option value="' + kmd_addr_list_with_balance[index].addr + '" data-total="' + kmd_addr_list_with_balance[index].total.toFixed(8) + '">[ ' + kmd_addr_list_with_balance[index].total.toFixed(8) + ' KMD ] &emsp;' + kmd_addr_list_with_balance[index].addr + '</option>';
$('#kmd_wallet_send_from').html(tmpoptions);
@ -92,7 +91,7 @@ var KMDWalletDashboard = function() {
$('#kmd_wallet_total_value').text(total_minus_currency_fee.toFixed(8));
if ($('#kmd_wallet_send_from').val() != '- Select Transparent or Private KMD Address -' &&
if ($('#kmd_wallet_send_from').val() != '- ' + _lang[defaultLang].KMD_NATIVE.SELECT_ADDRESS_ALT + ' -' &&
$('#kmd_wallet_amount').val() != '' &&
$('#kmd_wallet_sendto') != '' &&
$('#kmd_wallet_fee') != '' ) {
@ -156,19 +155,19 @@ var KMDWalletDashboard = function() {
messages: {
kmd_wallet_send_from: {
required: 'From Address is required.'
required: _lang[defaultLang].DASHBOARD.SEND_FROMADDR_REQ
},
kmd_wallet_sendto: {
required: 'To Address is required.'
required: _lang[defaultLang].DASHBOARD.SEND_TOADDR_REQ
},
kmd_wallet_amount: {
required: 'Please enter KMD amount to send.'
required: _lang[defaultLang].DASHBOARD.SEND_AMOUNT_REQ
},
kmd_wallet_fee: {
required: 'Make sure you have fee entered. Default value is 0.0001 KMD.'
required: _lang[defaultLang].DASHBOARD.SEND_FEE_REQ + ' 0.0001 KMD.'
},
kmd_wallet_total_value: {
required: 'Make sure you have both amount and fee entered to calculate final total.'
required: _lang[defaultLang].DASHBOARD.SEND_TOTAL_REQ
}
},
@ -229,14 +228,14 @@ var KMDWalletDashboard = function() {
console.log('get new T address button clicked...');
KMDGetNewAddresses('public');
KMDListAllAddr();
toastr.info('Receiving Address list updated', 'Wallet Notification');
toastr.info(_lang[defaultLang].TOASTR.RECADDR_UPDATED, _lang[defaultLang].TOASTR.WALLET_NOTIFICATION);
});
$('#kmd_get_new_zaddr').click(function() {
console.log('get new Z address button clicked...');
KMDGetNewAddresses('private');
KMDListAllAddr();
toastr.info('Receiving Address list updated', 'Wallet Notification');
toastr.info(_lang[defaultLang].TOASTR.RECADDR_UPDATED, _lang[defaultLang].TOASTR.WALLET_NOTIFICATION);
});
};
@ -308,13 +307,13 @@ function RunKMDInitFunctions() {
console.log(check1[0]);
if ( check1[0] == 'not active' ) {
console.log('Could not connect to external wallet. Is external wallet running?');
toastr.error('Connection Error. Is external wallet running?', 'Wallet Notification');
toastr.error(_lang[defaultLang].TOASTR.KMD_NATIVE_CON_ERROR, _lang[defaultLang].TOASTR.WALLET_NOTIFICATION);
$('#extcoin-wallet').hide();
$('#extcoin-wallet-connection-alert').show();
}
if ( check1[0] == 'null return' ) {
console.log('Could not connect to external wallet. Is iguana connected to external wallet?');
toastr.error('Connection Error. Is iguana connected to external wallet?', 'Wallet Notification');
toastr.error(_lang[defaultLang].TOASTR.KMD_IGUANA_CON_ERROR, _lang[defaultLang].TOASTR.WALLET_NOTIFICATION);
$('#extcoin-wallet').hide();
$('#extcoin-wallet-connection-alert').show();
}
@ -564,7 +563,6 @@ function getKMDBalanceT() {
});
}
function getKMDBalanceZ() {
var passthru_agent = getPassthruAgent(),
tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
@ -738,9 +736,8 @@ function KMDlistunspentT() {
}
function KMDListaddrZ() {
var result = [];
var passthru_agent = getPassthruAgent(),
var result = [],
passthru_agent = getPassthruAgent(),
tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
ajax_data = {
'userpass': tmpIguanaRPCAuth,
@ -852,26 +849,26 @@ function KMDGetPublicTransactions() {
tmp_addr = AjaxOutputData[index].address;
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>';
tmp_addr = '<i class="icon fa-bullseye"></i> <span class="label label-dark">' + _lang[defaultLang].TOASTR.ZADDR_NOT_LISTED + '!</span>';
}
var tmp_secondsToString = secondsToString(AjaxOutputData[index].time);
if ( AjaxOutputData[index].category == 'send' ) {
tmp_category = '<i class="icon fa-arrow-circle-left"></i> OUT';
tmp_category = '<i class="icon fa-arrow-circle-left"></i> '._lang[defaultLang].TOASTR.OUT;
}
if ( AjaxOutputData[index].category == 'receive' ) {
tmp_category = '<i class="icon fa-arrow-circle-right"></i> IN';
tmp_category = '<i class="icon fa-arrow-circle-right"></i> ' + _lang[defaultLang].TOASTR.IN;
}
if ( AjaxOutputData[index].category == 'generate' ) {
tmp_category = '<i class="icon fa-cogs"></i> Mined';
tmp_category = '<i class="icon fa-cogs"></i> ' + _lang[defaultLang].TOASTR.MINED;
}
if ( AjaxOutputData[index].category == 'immature' ) {
tmp_category = '<i class="icon fa-clock-o"></i> Immature';
tmp_category = '<i class="icon fa-clock-o"></i> ' + _lang[defaultLang].TOASTR.IMMATURE;
}
tmplisttransactions = [
'<span class="label label-default">' +
'<i class="icon fa-eye"></i> public' +
'<i class="icon fa-eye"></i> ' + _lang[defaultLang].IAPI.PUBLIC_SM +
'</span>',
tmp_category,
AjaxOutputData[index].confirmations,
@ -918,10 +915,10 @@ function KMDGetProtectedTransactions() {
tmpIguanaRPCAuth = 'tmpIgRPCUser@ '+ sessionStorage.getItem('IguanaRPCAuth'),
ajax_data = {
'userpass': tmpIguanaRPCAuth,
"agent": passthru_agent,
"method": "passthru",
"function": "z_listreceivedbyaddress",
"hex": tmpzaddr_hex_input
'agent': passthru_agent,
'method': 'passthru',
'function': 'z_listreceivedbyaddress',
'hex': tmpzaddr_hex_input
};
$.ajax({
@ -933,7 +930,7 @@ function KMDGetProtectedTransactions() {
var AjaxOutputData = JSON.parse(data); // Ajax output gets the whole list of unspent coin with addresses
$.each(AjaxOutputData, function(index, txidvalue) {
var tmp_category = '<i class="icon fa-arrow-circle-right"></i> IN';
var tmp_category = '<i class="icon fa-arrow-circle-right"></i> ' + _lang[defaultLang].TOASTR.IN;
var tmp_addr = value.addr.slice(0, 30) + '...';
if (!('amount' in txidvalue)) {
var tmp_amount = 0;
@ -946,7 +943,7 @@ function KMDGetProtectedTransactions() {
tmp_secondsToString = secondsToString(tmp_addr_txid_info[0].time),
tmplistZtransactions = [
'<span class="label label-dark">' +
'<i class="icon fa-eye-slash"></i> private' +
'<i class="icon fa-eye-slash"></i> ' + _lang[defaultLang].KMD_NATIVE.PRIVATE +
'</span>',
tmp_category,
tmp_confirmations,
@ -1075,7 +1072,6 @@ function KMDListAddresses(pubpriv) {
return result;
}
function KMDGetNewAddresses(pubpriv) {
NProgress.done(true);
NProgress.configure({
@ -1113,7 +1109,7 @@ function KMDGetNewAddresses(pubpriv) {
url: 'http://127.0.0.1:7778',
success: function(data, textStatus, jqXHR) {
result = data;
toastr.success('New address generated successfully', 'Wallet Notification');
toastr.success(_lang[defaultLang].KMD_NATIVE.NEW_ADDR_GENERATED, _lang[defaultLang].TOASTR.WALLET_NOTIFICATION);
},
error: function(xhr, textStatus, error) {
console.log('failed getting Coin History.');
@ -1133,7 +1129,10 @@ function KMDGetNewAddresses(pubpriv) {
function KMDListAllAddr() {
NProgress.done(true);
NProgress.configure({
template: '<div class="bar nprogress-bar-header nprogress-bar-info" role="bar"></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'
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();
@ -1144,11 +1143,11 @@ function KMDListAllAddr() {
$.each(listAlladdr, function(index, value) {
tmp_addr_label = '<span class="label label-default">' +
'<i class="icon fa-eye"></i> public' +
'<i class="icon fa-eye"></i> ' + _lang[defaultLang].IAPI.PUBLIC_SM +
'</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' +
'<i class="icon fa-eye-slash"></i> ' + _lang[defaultLang].KMD_NATIVE.PRIVATE +
'</span>';
}
//var tmp_addr_action_button = '<button></button>';
@ -1283,27 +1282,27 @@ function KMDListAllOPIDs() {
if (listOPIDs[0][index].status === 'queued') {
tmp_status_label = '<span class="label label-warning">' +
'<i class="icon fa-eye"></i> Queued' +
'<i class="icon fa-eye"></i> ' + _lang[defaultLang].KMD_NATIVE.QUEUED +
'</span>';
tmp_results = '<i>Please press refresh button in a minute or so to see updated status...</i>';
tmp_results = '<i>' + _lang[defaultLang].KMD_NATIVE.PLEASE_REFRESH + '...</i>';
}
if (listOPIDs[0][index].status === 'executing') {
tmp_status_label = '<span class="label label-info">' +
'<i class="icon fa-eye"></i> Executing' +
'<i class="icon fa-eye"></i> ' + _lang[defaultLang].KMD_NATIVE.EXECUTING +
'</span>';
tmp_results = '<i>Please press refresh button in a minute or so to see updated status...</i>';
tmp_results = '<i>' + _lang[defaultLang].KMD_NATIVE.PLEASE_REFRESH + '...</i>';
}
if (listOPIDs[0][index].status === 'failed') {
tmp_status_label = '<span class="label label-danger">' +
'<i class="icon fa-eye"></i> Failed' +
'<i class="icon fa-eye"></i> ' + _lang[defaultLang].KMD_NATIVE.FAILED +
'</span>';
tmp_results = '<b>Error Code:</b> ' + listOPIDs[0][index].error.code + '<br> <b>Message:</b> ' + listOPIDs[0][index].error.message;
tmp_results = '<b>Error Code:</b> ' + listOPIDs[0][index].error.code + '<br> <b>' + _lang[defaultLang].KMD_NATIVE.MESSAGE + ':</b> ' + listOPIDs[0][index].error.message;
}
if (listOPIDs[0][index].status === 'success') {
tmp_status_label = '<span class="label label-success">' +
'<i class="icon fa-eye"></i> Success' +
'<i class="icon fa-eye"></i> ' + _lang[defaultLang].KMD_NATIVE.SUCCESS +
'</span>';
tmp_results = '<b>txid:</b> ' + listOPIDs[0][index].result.txid + '<br> <b>Execution Seconds:</b> ' + listOPIDs[0][index].execution_secs;
tmp_results = '<b>txid:</b> ' + listOPIDs[0][index].result.txid + '<br> <b>' + _lang[defaultLang].KMD_NATIVE.EXECUTION_SECONDS + ':</b> ' + listOPIDs[0][index].execution_secs;
}
opids_statuses_data.push([

92
assets/scripts/lang/en.js

@ -161,7 +161,97 @@ const _lang = {
'LOAD_DEBUG_LOG': 'Load debug log'
},
'DASHBOARD': {
'SELECT_ADDRESS': '- Select Address -'
'SELECT_ADDRESS': '- Select Address -',
'SEND_TOADDR_REQ': 'To Address is required.',
'SEND_FROMADDR_REQ': 'From Address is required.',
'SEND_AMOUNT_REQ': 'Please enter amount to send.',
'SEND_FEE_REQ': 'Make sure you have fee entered. Default value is',
'SEND_TOTAL_REQ': 'Make sure you have both amount and fee entered to calculate final total.',
'SEND_TX_PROGRESS': 'The transaction submitted is processing. Once processed the transaction details will be displayed here.'
},
'TOASTR': {
'WALLET_NOTIFICATION': 'Wallet Notification',
'ACCOUNT_NOTIFICATION': 'Account Notification',
'BASILISK_NOTIFICATION': 'Basilisk Notification',
'COIN_NOTIFICATION': 'Coin Notification',
'TX_NOTIFICATION': 'Transaction Notification',
'SERVICE_NOTIFICATION': 'Service Notification',
'LOGIN_NOTIFICATION': 'Login Notification',
'RECADDR_UPDATED': 'Receiving Address list updated',
'IGUANA_CONN_ERR': 'Unable to connect to Iguana',
'FETCHING_DATA': 'Fetching Data. Please wait for a minute to complete this task.',
'LESS_RESPONSES_REQ': 'Less than required responses. Please try again.',
'SWITCHED_TO': 'switched to',
'MODE': 'Mode',
'UNKNOWN': 'Unknown',
'ZADDR_NOT_LISTED': 'Z Address not listed by wallet',
'IN': 'IN',
'OUT': 'OUT',
'MINED': 'Mined',
'IMMATURE': 'Immature',
'TX_SENT': 'Transaction Sent',
'TX_SEND_ERR': 'Unable to complete transaction',
'LOOKS_LIKE': 'Looks like',
'ALREADY_RUNNING': 'already running',
'STARTED_IN': 'started in',
'IGUANA_CONN_ERR_ALT': 'Unable to connect with iguana service. 127.0.0.1:7778',
'IGUANA_ARE_YOU_SURE': 'Are you sure Iguana is running?',
'SIGNED_TX_GENERATED': 'Signed transaction generated',
'SENDING_TX': 'Sending Transaction to Network',
'SIGNED_TX_SENT': 'Signed transaction sent successfully',
'GETTING_TXID_INFO': 'Getting txid info for updating funds data',
'REFRESHING_FUNDS': 'Refreshing Wallet Funds',
'TX_FAILED': 'Sent Transaction failed. Please check send Transaction page for details.',
'TX_SENT_ALT': 'Transaction sent successfully. Check send section for details.',
'COIN_STARTED': 'coin started',
'ADDR_ALREADY_REG': 'address already registered on network.',
'REG': 'Registered',
'REG_ADDR': 'address on network.',
'REG_ADDR_FAILED': 'address Registeration failed. Please try again.',
'INVALID_QUERY': 'Invalid query sent for',
'TRY_AGAIN': 'Please try again.',
'ADDR_ISNT_REG': 'Address isn\'t Registered on Network. Please Register',
'INVALID_QUERY_ALT': 'Invalid query sent. Please try again.',
'VALIDATION_SUCCESS': 'Validation Success on Network',
'KMD_NATIVE_CON_ERROR': 'Connection Error. Is external wallet running?',
'KMD_IGUANA_CON_ERROR': 'Connection Error. Is iguana connected to external wallet?',
'LOGIN_SUCCESSFULL': 'Login Successfull',
'NO_COIN_RUNNING': 'Seems like there\'s no coin running. Activating BTC.',
'OPPS': 'Opps... Something went wrong!',
'INVALID_PASSPHRASE': 'Invalid Passphrase. Make sure your passphrase is correct, or create new wallet.',
'WALLET_CREATED_SUCCESFULLY': 'Wallet created successfully',
'LOGOUT_SUCCESSFULL': 'Logout Successfull',
'WALLET_LOCKED': 'Wallet Locked Successfully',
},
'COIN_WALLETS': {
'TX_FAILED': 'Transaction Failed',
'TX_SUCCESS': 'Transaction Successful',
'TX': 'Transaction'
},
'IAPI': {
'PUBLIC_SM': 'public'
},
'KMD_NATIVE': {
'SELECT_ADDRESS': 'Select Transparent or Private Address',
'SELECT_ADDRESS_ALT': 'Select Transparent or Private KMD Address',
'PRIVATE': 'private',
'NEW_ADDR_GENERATED': 'New address generated successfully',
'QUEUED': 'Queued',
'PLEASE_REFRESH': 'Please press refresh button in a minute or so to see updated status',
'EXECUTING': 'Executing',
'FAILED': 'Failed',
'SUCCESS': 'Success',
'MESSAGE': 'Message',
'EXECUTION_SECONDS': 'Execution Seconds'
},
'LOGIN': {
'PWD_REQ': 'Password is required.',
'WALLET_SEED_REQ': 'Wallet seed is required.',
'SAVED_WALLET_SEED': 'Have you saved your wallet seed?',
'SEED_MAKE_SURE_BACKEDUP': 'Make sure you have it backed up. Without this seed you won\'t be able to access your wallet in the future!',
'YES_I_BACKEDUP': 'Yes, I have taken backup.',
'WALLET_LOCKED_LOGIN': 'Wallet Locked. Please login.',
'UNLOCK': 'Unlock'
}
}
};

63
assets/scripts/login.js

@ -26,7 +26,7 @@ var Login = function() {
messages: {
password: {
required: 'Password is required.'
required: _lang[defaultLang].LOGIN.PWD_REQ
}
},
@ -49,11 +49,12 @@ var Login = function() {
},
submitHandler: function(form) {
var jumblr_setpassphrase_val = 'jumblr '+$('#password').val()
console.log(jumblr_setpassphrase_val)
Iguana_Jumblr_SetPassphrase({'passphrase':jumblr_setpassphrase_val}).then(function(result){
console.log(result)
}).then(function(){
var jumblr_setpassphrase_val = 'jumblr ' + $('#password').val();
console.log(jumblr_setpassphrase_val);
Iguana_Jumblr_SetPassphrase({ 'passphrase': jumblr_setpassphrase_val }).then(function(result) {
console.log(result);
})
.then(function(){
var tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
ajax_data = {
'userpass': tmpIguanaRPCAuth,
@ -75,7 +76,7 @@ var Login = function() {
sessionStorage.setItem('IguanaActiveAccount', LoginDataToStore);
if (LoginOutput.result === 'success') {
console.log('Success');
toastr.success('Login Successfull', 'Account Notification')
toastr.success(_lang[defaultLang].TOASTR.LOGIN_SUCCESSFULL, _lang[defaultLang].TOASTR.ACCOUNT_NOTIFICATION)
$('#password').val('')
$('#wallet-login').hide();
@ -87,7 +88,7 @@ var Login = function() {
} else {
// If something goes wrong, alert the error message that our service returned
if (LoginOutput.error === 'bitcoinrpc needs coin that is active') {
toastr.info('Seems like there\'s no coin running. Activating BTC.', 'Coin Notification');
toastr.info(_lang[defaultLang].TOASTR.NO_COIN_RUNNING, _lang[defaultLang].TOASTR.COIN_NOTIFICATION);
var logincoinnames = [];
$('#logincoinslist input[type=checkbox]:checked').each(function() { logincoinnames.push(this.value); });
console.log(logincoinnames);
@ -119,9 +120,9 @@ var Login = function() {
}
});
} else if ( LoginOutput.error === 'invalid passphrase' ) {
toastr.info('Invalid Passphrase. Make sure your passphrase is correct, or create new wallet.', 'Login Notification');
toastr.info(_lang[defaultLang].TOASTR.INVALID_PASSPHRASE, _lang[defaultLang].TOASTR.LOGIN_NOTIFICATION);
} else {
toastr.warning('Opps... Something went wrong!', 'Account Notification');
toastr.warning(_lang[defaultLang].TOASTR.OPPS, _lang[defaultLang].TOASTR.ACCOUNT_NOTIFICATION);
}
console.log(data.statusText);
@ -193,7 +194,7 @@ var Login = function() {
messages: {
rwalletseed: {
required: 'Wallet seed is required.'
required: _lang[defaultLang].LOGIN.WALLET_SEED_REQ
}
},
@ -223,7 +224,7 @@ var Login = function() {
submitHandler: function(form) {
swal({
title: 'Have you saved your wallet seed?',
title: _lang[],
text: 'Make sure you have it backed up. Without this seed you won\'t be able to access your wallet in the future!',
type: 'warning',
showCancelButton: true,
@ -250,18 +251,18 @@ var Login = function() {
if (CreateWalletOutput.result === 'success') {
console.log('Success');
toastr.success('Wallet created successfully', 'Account Notification');
toastr.success(_lang[defaultLang].TOASTR.WALLET_CREATED_SUCCESFULLY, _lang[defaultLang].TOASTR.ACCOUNT_NOTIFICATION);
// Iguana_DEXImportAll();
$('#wallet-handle').val('');
$('#password').val('');
} else {
// If something goes wrong, alert the error message that our service returned
toastr.warning('Opps... Something went wrong!', 'Account Notification');
toastr.warning(_lang[defaultLang].TOASTR.OPPS, _lang[defaultLang].TOASTR.ACCOUNT_NOTIFICATION);
console.log(CreateWalletOutput);
if (CreateWalletOutput.error === 'bitcoinrpc needs coin that is active') {
toastr.info('Seems like there\'s no coin running. Activating BTC.', 'Coin Notification');
toastr.info(_lang[defaultLang].TOASTR.NO_COIN_RUNNING, _lang[defaultLang].TOASTR.COIN_NOTIFICATION);
var logincoinnames = [];
$('#logincoinslist input[type=checkbox]:checked').each(function() { logincoinnames.push(this.value); });
console.log(logincoinnames);
@ -278,7 +279,7 @@ var Login = function() {
if (index == '0' ) {
console.log(value + ' ' + index);
$('.register-form').submit();
toastr.success('Wallet created successfully', 'Account Notification');
toastr.success(_lang[defaultLang].TOASTR.WALLET_CREATED_SUCCESFULLY, _lang[defaultLang].TOASTR.ACCOUNT_NOTIFICATION);
}
}
if ( value == 'BTCD' ) {
@ -292,12 +293,12 @@ var Login = function() {
if (index == '0' ) {
console.log(value + ' ' + index);
$('.register-form').submit();
toastr.success('Wallet created successfully', 'Account Notification');
toastr.success(_lang[defaultLang].TOASTR.WALLET_CREATED_SUCCESFULLY, _lang[defaultLang].TOASTR.ACCOUNT_NOTIFICATION);
}
}
});
} else {
toastr.warning('Opps... Something went wrong!', 'Account Notification');
toastr.warning(_lang[defaultLang].TOASTR.OPPS, _lang[defaultLang].TOASTR.ACCOUNT_NOTIFICATION);
}
console.log(data.statusText);
@ -318,7 +319,7 @@ var Login = function() {
}
console.log(textStatus);
console.log(error);
toastr.warning('Opps... Something went wrong!', 'Account Notification');
toastr.warning(_lang[defaultLang].TOASTR.OPPS, _lang[defaultLang].TOASTR.ACCOUNT_NOTIFICATION);
}
});
@ -381,7 +382,7 @@ var Login = function() {
if (LogoutOutput.result === 'success') {
console.log('Success');
toastr.success('Logout Successfull', 'Account Notification');
toastr.success(_lang[defaultLang].TOASTR.LOGOUT_SUCCESSFULL, _lang[defaultLang].TOASTR.ACCOUNT_NOTIFICATION);
$('#wallet-login').show();
$('body').removeClass( '' ).addClass( 'page-login layout-full page-dark' );
$('#wallet-core').hide();
@ -400,7 +401,7 @@ var Login = function() {
StopTotalFiatValue();
} else {
// If something goes wrong, alert the error message that our service returned
toastr.warning('Opps... Something went wrong!', 'Account Notification');
toastr.warning(_lang[defaultLang].TOASTR.OPPS, _lang[defaultLang].TOASTR.ACCOUNT_NOTIFICATION);
console.log(data.statusText);
if ( xhr.readyState == 0 ) {
Iguana_ServiceUnavailable();
@ -417,7 +418,7 @@ var Login = function() {
}
console.log(textStatus);
console.log(error);
toastr.warning('Opps... Something went wrong!', 'Account Notification');
toastr.warning(_lang[defaultLang].TOASTR.OPPS, _lang[defaultLang].TOASTR.ACCOUNT_NOTIFICATION);
}
});
});
@ -464,22 +465,22 @@ var Login = function() {
if (ActiveHandleOutput.status === 'locked') {
console.log('Success');
toastr.success('Wallet Locked Successfully', 'Account Notification');
toastr.success(_lang[defaultLang].TOASTR.WALLET_LOCKED, _lang[defaultLang].TOASTR.ACCOUNT_NOTIFICATION);
$('#wallet-login').show();
$('body').removeClass( '' ).addClass( 'page-login layout-full page-dark' );
$('#wallet-core').hide();
$('link[id=loginStyle]')[0].disabled = false;
$("#loginbtn").text('Unlock');
$("#loginbtn").text(_lang[defaultLang].LOGIN.UNLOCK);
// Hide some login fields not needing at lock screen
console.log('Wallet is Locked.');
$('#login-welcome').text('Wallet Locked. Please login.');
$('#login-welcome').text(_lang[defaultLang].LOGIN.WALLET_LOCKED_LOGIN);
$('#register-btn').hide();
$('#logint-another-wallet').show();
$('#logincoinslist').hide();
} else {
// If something goes wrong, alert the error message that our service returned
toastr.warning('Opps... Something went wrong!', 'Account Notification');
toastr.warning(_lang[defaultLang].TOASTR.OPPS, _lang[defaultLang].TOASTR.ACCOUNT_NOTIFICATION);
console.log(data.statusText);
if ( xhr.readyState == 0 ) {
Iguana_ServiceUnavailable();
@ -496,7 +497,7 @@ var Login = function() {
}
console.log(textStatus);
console.log(error);
toastr.warning('Opps... Something went wrong!', 'Account Notification');
toastr.warning(_lang[defaultLang].TOASTR.OPPS, _lang[defaultLang].TOASTR.ACCOUNT_NOTIFICATION);
}
});
// End Check Active Wallet's status
@ -511,7 +512,7 @@ var Login = function() {
}
console.log(textStatus);
console.log(error);
toastr.warning('Opps... Something went wrong!', 'Account Notification');
toastr.warning(_lang[defaultLang].TOASTR.OPPS, _lang[defaultLang].TOASTR.ACCOUNT_NOTIFICATION);
}
});
});
@ -545,9 +546,9 @@ var Login = function() {
$('#wallet-core').fadeIn();
} else if ( JSON.parse(CheckLoginData).status === 'locked' ) {
console.log('Wallet is Locked.');
$('#login-welcome').text('Wallet Locked. Please login');
$('#login-welcome').text(_lang[defaultLang].LOGIN.WALLET_LOCKED_LOGIN);
$('#register-btn').hide();
$("#loginbtn").text('Unlock');
$("#loginbtn").text(_lang[defaultLang].LOGIN.UNLOCK);
$('#section-login-addcoin-btn').hide();
$('#section-login').show();
}
@ -669,7 +670,7 @@ var Login = function() {
if (LogoutOutput.result === 'success') {
console.log('Success');
toastr.success('Logout Successfull', 'Account Notification');
toastr.success(_lang[defaultLang].TOASTR.LOGOUT_SUCCESSFULL, _lang[defaultLang].TOASTR.ACCOUNT_NOTIFICATION);
$('#wallet-login').show();
$('body').removeClass( '' ).addClass( 'page-login layout-full page-dark' );

85
index.html

@ -2286,22 +2286,22 @@
<!-- Iguana API Scripts -->
<script src="assets/scripts/iguana_api.js"></script>
<script src="assets/scripts/iguana_api/IguanaUnused.js"></script>
<!--script src="assets/scripts/iguana_api/IguanaUnused.js"></script>
<script src="assets/scripts/iguana_api/IguanaHandle.js"></script>
<script src="assets/scripts/iguana_api/IguanaAddcoin.js"></script>
<script src="assets/scripts/iguana_api/IguanaEDEX.js"></script>
<script src="assets/scripts/iguana_api/IguanaDEX.js"></script>
<script src="assets/scripts/iguana_api/IguanaShepherd.js"></script>
<script src="assets/scripts/iguana_api/IguanaShepherd.js"></script-->
<!-- End Iguana API Scripts -->
<script src="assets/scripts/login.js"></script>
<!-- Dashboard Scripts -->
<script src="assets/scripts/dashboard.js"></script>
<script src="assets/scripts/dashboard/DashboardEDEX.js"></script>
<!--script src="assets/scripts/dashboard/DashboardEDEX.js"></script>
<script src="assets/scripts/dashboard/DashboardDEX.js"></script>
<script src="assets/scripts/dashboard/DashboardBasilisk.js"></script>
<script src="assets/scripts/dashboard/DashboardCoinFiat.js"></script>
<script src="assets/scripts/dashboard/DashboardCoinFiat.js"></script-->
<!-- End Dashboard Scripts -->
<!--<script src="assets/scripts/coinwallets.js"></script>-->
@ -2324,7 +2324,6 @@
<script src="assets/scripts/lang.js"></script>
<script src="assets/scripts/lang/en.js"></script>
<script src="assets/scripts/payloadtest.js"></script>
<script type="text/javascript">
(function(document, window, $) {
@ -2342,81 +2341,7 @@
});
lang();
});
console.log(payloadtest);
/*$.ajax({
async: false,
type: 'POST',
data: JSON.stringify({ 'filename': 'test', 'payload': JSON.stringify(payloadtest) }),
url: 'http://127.0.0.1:17777/shepherd/groom',
contentType: 'application/json', // send as JSON
success: function(data, textStatus, jqXHR) {
var AjaxOutputData = JSON.parse(data);
console.log(AjaxOutputData);
},
error: function(xhr, textStatus, error) {
console.log(error);
//console.log(xhr.statusText);
//if ( xhr.readyState == 0 ) {
//}
//console.log(textStatus);
//console.log(error);
}
});*/
function removeTXID(_obj, txidArray) {
var txidToStr = txidArray.join(':');
console.log(txidToStr);
if (_obj, _obj.basilisk) {
if (Object.keys(_obj.basilisk).length === 0) {
console.log('no coin nodes to parse');
} else {
for (var key in _obj.basilisk) {
for (var coinAddr in _obj.basilisk[key]) {
if (_obj.basilisk[key][coinAddr] !== 'addresses') {
if (_obj.basilisk[key][coinAddr].refresh &&
_obj.basilisk[key][coinAddr].refresh.data &&
_obj.basilisk[key][coinAddr].refresh.data.length > 0) {
for (var i = 0; i < _obj.basilisk[key][coinAddr].refresh.data.length; i++) {
if (txidToStr.indexOf(_obj.basilisk[key][coinAddr].refresh.data[i].txid) > -1) {
delete _obj.basilisk[key][coinAddr].refresh.data[i];
}
}
}
}
}
}
}
} else {
console.log('basilisk node is missing');
}
return _obj;
}
var txid = ['9252eaea4c03d31f1aa83baeebe6253d8ca4a1d6d5ddca3ef4af9afc8da99e03', '243a70ca3e549b40582a57d82cfc85e57f48c8f39966db9ed020d6e6d4bef3f7'];
var newpayload = removeTXID(payloadtest, txid);
$.ajax({
async: false,
type: 'POST',
data: JSON.stringify({ 'filename': 'test', 'payload': JSON.stringify(newpayload) }),
url: 'http://127.0.0.1:17777/shepherd/groom',
contentType: 'application/json', // send as JSON
success: function(data, textStatus, jqXHR) {
var AjaxOutputData = JSON.parse(data);
console.log(AjaxOutputData);
},
error: function(xhr, textStatus, error) {
console.log(error);
//console.log(xhr.statusText);
//if ( xhr.readyState == 0 ) {
//}
//console.log(textStatus);
//console.log(error);
}
});
});
})(document, window, jQuery);
jQuery(document).ready(function() {

Loading…
Cancel
Save