Ethereum Blockchain fully Sync status recognized

This commit is contained in:
Luis Fernando Molina committed 2020-11-17 13:58:13 +01:00
1 parent dff8fc1e18
commit 9bf8c2eed6
16 files changed
+59 -40

No files matched your search

@@ -8,7 +8,7 @@ function newGeth() {
return thisObject
function install(node) {
callWebServer('ExecuteTerminalCommand/dir')
httpRequest('ExecuteTerminalCommand/dir')
}
function run(node) {
@@ -85,7 +85,19 @@ function newEthereumBlockchainSpace() {
interface: clientInterface
}
callWebServer(JSON.stringify(params), 'WEB3', onResponse)
/*
Next, we will check which Superalgos Network Node we need as a gateway
to the Ethereum Client. We will use the current node reference parent for that.
*/
if (networkClient.payload.referenceParent === undefined) {
networkClient.payload.uiObject.setErrorMessage('You need to reference a Superalgos Network Node so that it acts as a gateway to the Ethereum Client.')
return
}
let networkNodeConfig = JSON.parse(networkClient.payload.referenceParent.config)
let url = 'http://' + networkNodeConfig.host + ':' + networkNodeConfig.webPort + '/' + 'WEB3'
httpRequest(JSON.stringify(params), url, onResponse)
function onResponse(err, data) {
/* Lets check the result of the call through the http interface */
@@ -117,7 +129,13 @@ function newEthereumBlockchainSpace() {
if (status.chainId > 0) {
let networkName = UI.projects.ethereum.globals.chainIds.chainNameById(status.chainId)
networkClient.payload.uiObject.setStatus('Connected to ' + networkName + ' via http. ', ANNIMATION_CYCLES_TO_LAST)
networkClient.payload.uiObject.setStatus('Connected to ' + networkName + ' via the ' + clientInterface + ' interface, through ' + networkClient.payload.referenceParent.name + ' Network Node.', ANNIMATION_CYCLES_TO_LAST)
networkClient.payload.uiObject.valueAtAngle = false
networkClient.payload.uiObject.setValue(
'Current Block Number ' + splitLargeNumber(status.currentBlockNumber)
, 200)
networkClient.payload.uiObject.setPercentage('100.00', ANNIMATION_CYCLES_TO_LAST)
return
}
@@ -141,7 +159,7 @@ function newEthereumBlockchainSpace() {
if (status.isSyncing.currentBlock !== status.isSyncing.highestBlock) {
networkClient.payload.uiObject.setStatus('Connected via http. Client is Syncing... ' + extraStatus, ANNIMATION_CYCLES_TO_LAST)
}
}
function splitLargeNumber(number) {
let label = number.toString()
@@ -31,7 +31,7 @@ function newCryptoEcosystemFunctions() {
}
}
callWebServer(JSON.stringify(params), 'CCXT', onResponse)
httpRequest(JSON.stringify(params), 'CCXT', onResponse)
function onResponse(err, data) {
if (err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
@@ -79,7 +79,7 @@ function newCryptoEcosystemFunctions() {
exchangeId: exchangeId,
method: 'fetchMarkets'
}
callWebServer(JSON.stringify(params), 'CCXT', onResponse)
httpRequest(JSON.stringify(params), 'CCXT', onResponse)
function onResponse(err, data) {
if (err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
@@ -161,7 +161,7 @@ function newCryptoEcosystemFunctions() {
exchangeId: exchangeId,
method: 'fetchMarkets'
}
callWebServer(JSON.stringify(params), 'CCXT', onResponse)
httpRequest(JSON.stringify(params), 'CCXT', onResponse)
function onResponse(err, data) {
if (err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
@@ -11,7 +11,7 @@ function newPluginsFunctions() {
return thisObject
function getPluginFileNames(projectName, pluginType, callBack) {
callWebServer(undefined, 'PluginFileNames/' + projectName + '/' + pluginType, onResponse)
httpRequest(undefined, 'PluginFileNames/' + projectName + '/' + pluginType, onResponse)
function onResponse(err, data) {
if (err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
@@ -37,7 +37,7 @@ function newPluginsFunctions() {
function pluginMissingProjects(node, rootNodes, functionLibraryUiObjectsFromNodes) {
let url = 'ProjectNames'
callWebServer(undefined, url, onResponse)
httpRequest(undefined, url, onResponse)
function onResponse(err, pProjects) {
let projects = JSON.parse(pProjects)
@@ -99,7 +99,7 @@ function newUiObjectsFromNodes() {
for (let i = 0; i < pluginFiles.length; i++) {
let pluginFile = pluginFiles[i]
let name = pluginFile.name
callWebServer(undefined, 'LoadPlugin' + '/' + 'Superalgos' + '/' + pluginType + '/' + name + '.json', onFileReceived)
httpRequest(undefined, 'LoadPlugin' + '/' + 'Superalgos' + '/' + pluginType + '/' + name + '.json', onFileReceived)
function onFileReceived(err, text, response) {
@@ -9,7 +9,7 @@ function newWebhookFunctions() {
let testMessage = UI.projects.superalgos.utilities.nodeConfig.loadPropertyFromNodeConfig(node.payload, 'testMessage')
let letURL = UI.projects.superalgos.utilities.nodeConfig.loadPropertyFromNodeConfig(node.payload, 'webhookURL')
callWebServer(testMessage, letURL, onResponse)
httpRequest(testMessage, letURL, onResponse)
function onResponse(err) {
if (err.result === GLOBAL.DEFAULT_OK_RESPONSE.result) {
@@ -7,7 +7,7 @@ function newWorkspaceFunctions() {
function addMissingWorkspaceProjects(node, rootNodes, functionLibraryUiObjectsFromNodes) {
let url = 'ProjectNames'
callWebServer(undefined, url, onResponse)
httpRequest(undefined, url, onResponse)
function onResponse(err, pProjects) {
let projects = JSON.parse(pProjects)
@@ -60,7 +60,7 @@ function newSuperalgosDesignSpace() {
function loadIconCollection(callBack) {
callWebServer(undefined, 'IconNames', onResponse)
httpRequest(undefined, 'IconNames', onResponse)
function onResponse(err, data) {
if (err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
@@ -75,7 +75,7 @@ function newWorkspace() {
let lastUsedWorkspace = window.localStorage.getItem('Last Used Workspace')
if (lastUsedWorkspace !== 'undefined' && lastUsedWorkspace !== null && lastUsedWorkspace !== undefined) {
callWebServer(undefined, 'LoadMyWorkspace' + '/' + lastUsedWorkspace, onFileReceived)
httpRequest(undefined, 'LoadMyWorkspace' + '/' + lastUsedWorkspace, onFileReceived)
function onFileReceived(err, text, response) {
if (err && err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
UI.projects.superalgos.spaces.cockpitSpace.setStatus('Could not load the last Workspace used, called "' + lastUsedWorkspace + '". Will switch to the default Workspace instead.', 500, UI.projects.superalgos.spaces.cockpitSpace.statusTypes.WARNING)
@@ -172,7 +172,7 @@ function newWorkspace() {
}
let url = 'SaveWorkspace/' + workspace.name
callWebServer(textToSave, url, onResponse)
httpRequest(textToSave, url, onResponse)
return true
function onResponse(err) {
@@ -431,7 +431,7 @@ function newWorkspace() {
webCommand = 'LoadMyWorkspace' + '/' + name
}
callWebServer(undefined, webCommand, onFileReceived)
httpRequest(undefined, webCommand, onFileReceived)
function onFileReceived(err, text, response) {
if (err && err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
UI.projects.superalgos.spaces.cockpitSpace.setStatus('Could not load the Workspace called "' + name + '". ', 500, UI.projects.superalgos.spaces.cockpitSpace.statusTypes.WARNING)
@@ -90,7 +90,7 @@ function newListView() {
function turnOn() {
firstVisibleListItem = 1
callWebServer(undefined, 'ListWorkspaces', onResponse)
httpRequest(undefined, 'ListWorkspaces', onResponse)
function onResponse(err, text) {
if (err && err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {