|
@ -15,155 +15,158 @@ function RunKMDInitFunctions() { |
|
|
}); |
|
|
}); |
|
|
NProgress.start(); |
|
|
NProgress.start(); |
|
|
|
|
|
|
|
|
var check1 = CheckIfConnected(); |
|
|
function _RunKMDInitFunctions(check1) { |
|
|
console.log(check1[0]); |
|
|
console.log(check1[0]); |
|
|
if ( check1[0] == 'not active' ) { |
|
|
if ( check1[0] == 'not active' ) { |
|
|
console.log('Could not connect to external wallet. Is external wallet running?'); |
|
|
console.log('Could not connect to external wallet. Is external wallet running?'); |
|
|
toastr.error(_lang[defaultLang].TOASTR.KMD_NATIVE_CON_ERROR, _lang[defaultLang].TOASTR.WALLET_NOTIFICATION); |
|
|
toastr.error(_lang[defaultLang].TOASTR.KMD_NATIVE_CON_ERROR, _lang[defaultLang].TOASTR.WALLET_NOTIFICATION); |
|
|
$('#extcoin-wallet').hide(); |
|
|
$('#extcoin-wallet').hide(); |
|
|
$('#extcoin-wallet-connection-alert').show(); |
|
|
$('#extcoin-wallet-connection-alert').show(); |
|
|
} |
|
|
} |
|
|
if ( check1[0] == 'null return' ) { |
|
|
if ( check1[0] == 'null return' ) { |
|
|
console.log('Could not connect to external wallet. Is iguana connected to external wallet?'); |
|
|
console.log('Could not connect to external wallet. Is iguana connected to external wallet?'); |
|
|
toastr.error(_lang[defaultLang].TOASTR.KMD_IGUANA_CON_ERROR, _lang[defaultLang].TOASTR.WALLET_NOTIFICATION); |
|
|
toastr.error(_lang[defaultLang].TOASTR.KMD_IGUANA_CON_ERROR, _lang[defaultLang].TOASTR.WALLET_NOTIFICATION); |
|
|
$('#extcoin-wallet').hide(); |
|
|
$('#extcoin-wallet').hide(); |
|
|
$('#extcoin-wallet-connection-alert').show(); |
|
|
$('#extcoin-wallet-connection-alert').show(); |
|
|
} |
|
|
|
|
|
if ( check1[0] == 'activating' ) { |
|
|
|
|
|
$('#extcoin-wallet-activating-alert').show(); |
|
|
|
|
|
$('#extcoin-wallet').show(); |
|
|
|
|
|
$('#extcoin-wallet-connection-alert').hide(); |
|
|
|
|
|
|
|
|
|
|
|
function _getKMDInfo() { |
|
|
|
|
|
var passthru_agent = getPassthruAgent(), |
|
|
|
|
|
tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), |
|
|
|
|
|
ajax_data = { |
|
|
|
|
|
'userpass': tmpIguanaRPCAuth, |
|
|
|
|
|
'agent': passthru_agent, |
|
|
|
|
|
'method': 'passthru', |
|
|
|
|
|
'function': 'getinfo', |
|
|
|
|
|
'hex': '' |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
console.log(ajax_data); |
|
|
|
|
|
$.ajax({ |
|
|
|
|
|
type: 'POST', |
|
|
|
|
|
data: JSON.stringify(ajax_data), |
|
|
|
|
|
url: 'http://127.0.0.1:' + config.iguanaPort, |
|
|
|
|
|
success: function(data, textStatus, jqXHR) { |
|
|
|
|
|
var AjaxOutputData = JSON.parse(data); |
|
|
|
|
|
|
|
|
|
|
|
if (AjaxOutputData && !AjaxOutputData.blocks) { |
|
|
|
|
|
startBestBlockInterval(); |
|
|
|
|
|
} else { |
|
|
|
|
|
clearInterval(currentBestBlockInterval); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
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); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
if ( check1[0] == 'activating' ) { |
|
|
|
|
|
$('#extcoin-wallet-activating-alert').show(); |
|
|
|
|
|
$('#extcoin-wallet').show(); |
|
|
|
|
|
$('#extcoin-wallet-connection-alert').hide(); |
|
|
|
|
|
|
|
|
|
|
|
function _getKMDInfo() { |
|
|
|
|
|
var passthru_agent = getPassthruAgent(), |
|
|
|
|
|
tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), |
|
|
|
|
|
ajax_data = { |
|
|
|
|
|
'userpass': tmpIguanaRPCAuth, |
|
|
|
|
|
'agent': passthru_agent, |
|
|
|
|
|
'method': 'passthru', |
|
|
|
|
|
'function': 'getinfo', |
|
|
|
|
|
'hex': '' |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
console.log(ajax_data); |
|
|
|
|
|
$.ajax({ |
|
|
|
|
|
type: 'POST', |
|
|
|
|
|
data: JSON.stringify(ajax_data), |
|
|
|
|
|
url: 'http://127.0.0.1:' + config.iguanaPort, |
|
|
|
|
|
success: function(data, textStatus, jqXHR) { |
|
|
|
|
|
var AjaxOutputData = JSON.parse(data); |
|
|
|
|
|
|
|
|
|
|
|
if (AjaxOutputData && !AjaxOutputData.blocks) { |
|
|
|
|
|
startBestBlockInterval(); |
|
|
|
|
|
} else { |
|
|
|
|
|
clearInterval(currentBestBlockInterval); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
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 getRemoteCurrentHeight() { |
|
|
function getRemoteCurrentHeight() { |
|
|
var extcoin = $('[data-extcoin]').attr('data-extcoin'); |
|
|
var extcoin = $('[data-extcoin]').attr('data-extcoin'); |
|
|
|
|
|
|
|
|
$.ajax({ |
|
|
$.ajax({ |
|
|
type: 'GET', |
|
|
type: 'GET', |
|
|
url: 'http://localhost:' + config.iguanaPort + '/api/dex/getinfo?userpass=tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth') + '&symbol=' + extcoin, |
|
|
url: 'http://localhost:' + config.iguanaPort + '/api/dex/getinfo?userpass=tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth') + '&symbol=' + extcoin, |
|
|
success: function(data, textStatus, jqXHR) { |
|
|
success: function(data, textStatus, jqXHR) { |
|
|
data = JSON.parse(data); |
|
|
data = JSON.parse(data); |
|
|
|
|
|
|
|
|
if (data && data.blocks) { |
|
|
if (data && data.blocks) { |
|
|
totalBlocksInExplorer = data.blocks; |
|
|
totalBlocksInExplorer = data.blocks; |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
error: function(xhr, textStatus, error) { |
|
|
|
|
|
console.log('failed getinfo from dex api'); |
|
|
|
|
|
console.log(xhr.statusText); |
|
|
|
|
|
console.log(textStatus); |
|
|
|
|
|
console.log(error); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}); |
|
|
error: function(xhr, textStatus, error) { |
|
|
} |
|
|
console.log('failed getinfo from dex api'); |
|
|
|
|
|
console.log(xhr.statusText); |
|
|
var currentBestBlockInterval; |
|
|
console.log(textStatus); |
|
|
function startBestBlockInterval() { |
|
|
console.log(error); |
|
|
currentBestBlockInterval = setInterval(function() { |
|
|
} |
|
|
if (!chainActivationLastUpdate || checkTimestamp(chainActivationLastUpdate) > chainActivationLastUpdateTimeout) { |
|
|
}); |
|
|
$.ajax({ |
|
|
} |
|
|
type: 'POST', |
|
|
|
|
|
data: { |
|
|
var currentBestBlockInterval; |
|
|
'herdname': 'komodo', |
|
|
function startBestBlockInterval() { |
|
|
'lastLines': 1 |
|
|
currentBestBlockInterval = setInterval(function() { |
|
|
}, |
|
|
if (!chainActivationLastUpdate || checkTimestamp(chainActivationLastUpdate) > chainActivationLastUpdateTimeout) { |
|
|
url: 'http://127.0.0.1:17777/shepherd/debuglog', |
|
|
$.ajax({ |
|
|
success: function(data, textStatus, jqXHR) { |
|
|
type: 'POST', |
|
|
if (data.indexOf('UpdateTip') > -1) { |
|
|
data: { |
|
|
var temp = data.split(' '); |
|
|
'herdname': 'komodo', |
|
|
|
|
|
'lastLines': 1 |
|
|
for (var i = 0; i < temp.length; i++) { |
|
|
}, |
|
|
if (temp[i].indexOf('height=') > -1) { |
|
|
url: 'http://127.0.0.1:17777/shepherd/debuglog', |
|
|
var currentBestChain = temp[i].replace('height=', ''); |
|
|
success: function(data, textStatus, jqXHR) { |
|
|
$('#activating-komodod-tridot').hide(); |
|
|
if (data.indexOf('UpdateTip') > -1) { |
|
|
$('#activating-komodod-progress').html(': ' + Math.floor(currentBestChain * 100 / totalBlocksInExplorer) + '% (blocks ' + currentBestChain + ' / ' + totalBlocksInExplorer + ')'); |
|
|
var temp = data.split(' '); |
|
|
chainActivationLastUpdate = Date.now(); |
|
|
|
|
|
if (currentBestChain === totalBlocksInExplorer) { |
|
|
for (var i = 0; i < temp.length; i++) { |
|
|
clearInterval(currentBestBlockInterval); |
|
|
if (temp[i].indexOf('height=') > -1) { |
|
|
} |
|
|
var currentBestChain = temp[i].replace('height=', ''); |
|
|
|
|
|
$('#activating-komodod-tridot').hide(); |
|
|
|
|
|
$('#activating-komodod-progress').html(': ' + Math.floor(currentBestChain * 100 / totalBlocksInExplorer) + '% (blocks ' + currentBestChain + ' / ' + totalBlocksInExplorer + ')'); |
|
|
|
|
|
chainActivationLastUpdate = Date.now(); |
|
|
|
|
|
if (currentBestChain === totalBlocksInExplorer) { |
|
|
|
|
|
clearInterval(currentBestBlockInterval); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
error: function(xhr, textStatus, error) { |
|
|
|
|
|
console.log('failed getting debug.log'); |
|
|
|
|
|
console.log(xhr.statusText); |
|
|
|
|
|
console.log(textStatus); |
|
|
|
|
|
console.log(error); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}); |
|
|
error: function(xhr, textStatus, error) { |
|
|
} |
|
|
console.log('failed getting debug.log'); |
|
|
}, 2000); |
|
|
console.log(xhr.statusText); |
|
|
} |
|
|
console.log(textStatus); |
|
|
|
|
|
console.log(error); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
}, 2000); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (sessionStorage.getItem('edexTmpMode') === 'Native') { |
|
|
|
|
|
getRemoteCurrentHeight(); |
|
|
|
|
|
|
|
|
|
|
|
var totalBlocksInExplorer = 0, |
|
|
if (sessionStorage.getItem('edexTmpMode') === 'Native') { |
|
|
totalBlocksInExplorerInterval = setInterval(function() { |
|
|
|
|
|
getRemoteCurrentHeight(); |
|
|
getRemoteCurrentHeight(); |
|
|
_getKMDInfo(); |
|
|
|
|
|
}, 60000); |
|
|
var totalBlocksInExplorer = 0, |
|
|
} else { |
|
|
totalBlocksInExplorerInterval = setInterval(function() { |
|
|
clearInterval(totalBlocksInExplorerInterval); |
|
|
getRemoteCurrentHeight(); |
|
|
clearInterval(currentBestBlockInterval); |
|
|
_getKMDInfo(); |
|
|
|
|
|
}, 60000); |
|
|
|
|
|
} else { |
|
|
|
|
|
clearInterval(totalBlocksInExplorerInterval); |
|
|
|
|
|
clearInterval(currentBestBlockInterval); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$('#kmd_wallet_dashoard_section').show(); |
|
|
|
|
|
$('#kmd_wallet_dashboardinfo').show(); |
|
|
|
|
|
$('#kmd_wallet_send').hide(); |
|
|
|
|
|
$('#kmd_wallet_recieve_section').hide(); |
|
|
|
|
|
$('#kmd_wallet_settings').hide(); |
|
|
|
|
|
} |
|
|
|
|
|
if ( check1[0] == 'connected') { |
|
|
|
|
|
getTotalKMDBalance(); |
|
|
|
|
|
KMDfillTxHistoryT(); |
|
|
|
|
|
$('#extcoin-wallet').show(); |
|
|
|
|
|
$('#extcoin-wallet-connection-alert').hide(); |
|
|
|
|
|
|
|
|
|
|
|
$('#kmd_wallet_dashoard_section').show(); |
|
|
|
|
|
$('#kmd_wallet_dashboardinfo').show(); |
|
|
|
|
|
$('#kmd_wallet_send').hide(); |
|
|
|
|
|
$('#kmd_wallet_recieve_section').hide(); |
|
|
|
|
|
$('#kmd_wallet_settings').hide(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$('#kmd_wallet_dashoard_section').show(); |
|
|
|
|
|
$('#kmd_wallet_dashboardinfo').show(); |
|
|
|
|
|
$('#kmd_wallet_send').hide(); |
|
|
|
|
|
$('#kmd_wallet_recieve_section').hide(); |
|
|
|
|
|
$('#kmd_wallet_settings').hide(); |
|
|
|
|
|
} |
|
|
|
|
|
if ( check1[0] == 'connected') { |
|
|
|
|
|
getTotalKMDBalance(); |
|
|
|
|
|
KMDfillTxHistoryT(); |
|
|
|
|
|
$('#extcoin-wallet').show(); |
|
|
|
|
|
$('#extcoin-wallet-connection-alert').hide(); |
|
|
|
|
|
|
|
|
|
|
|
$('#kmd_wallet_dashoard_section').show(); |
|
|
|
|
|
$('#kmd_wallet_dashboardinfo').show(); |
|
|
|
|
|
$('#kmd_wallet_send').hide(); |
|
|
|
|
|
$('#kmd_wallet_recieve_section').hide(); |
|
|
$('#kmd_wallet_recieve_section').hide(); |
|
|
$('#kmd_wallet_settings').hide(); |
|
|
NProgress.done(); |
|
|
} |
|
|
} |
|
|
|
|
|
CheckIfConnected(_RunKMDInitFunctions); |
|
|
|
|
|
|
|
|
$('#kmd_wallet_recieve_section').hide(); |
|
|
|
|
|
NProgress.done(); |
|
|
|
|
|
} |
|
|
} |