diff --git a/.vscode/Platorm.code-workspace b/.vscode/Platorm.code-workspace new file mode 100644 index 000000000..060330aa7 --- /dev/null +++ b/.vscode/Platorm.code-workspace @@ -0,0 +1,11 @@ +{ + "folders": [ + { + "path": "C:\\Superalgos\\Platform" + }, + { + "path": "C:\\Superalgos\\Projects" + } + ], + "settings": {} +} \ No newline at end of file diff --git a/DesktopRoot.js b/DesktopRoot.js new file mode 100644 index 000000000..b12742216 --- /dev/null +++ b/DesktopRoot.js @@ -0,0 +1,73 @@ +exports.newDesktopRoot = function newDesktopRoot() { + /* + This module represents the execution root of the Desktop App. + We use this module that is outside the Desktop folder to + load all node dependencies and get them ready to the actual App. + */ + let thisObject = { + run: run + } + + return thisObject + + async function run() { + /* + The DK object is accesible everywhere at the Superalgos Desktop App. + It provides access to all modules built for this App. + */ + global.DK = {} + /* + The SA object is accesible everywhere at the Superalgos Desktop App. + It provides access to all modules built for Superalgos in general. + */ + global.SA = {} + /* Load Environment Variables */ + let ENVIRONMENT = require('./EnvironmentForDebug.js'); + let ENVIRONMENT_MODULE = ENVIRONMENT.newEnvironment() + global.env = ENVIRONMENT_MODULE + /* + First thing is to load the project schema file. + */ + global.PROJECTS_SCHEMA = require(global.env.PATH_TO_PROJECT_SCHEMA) + /* + Setting up the modules that will be available, defined at the Project Schema file. + */ + let MULTI_PROJECT = require('./MultiProject.js'); + let MULTI_PROJECT_MODULE = MULTI_PROJECT.newMultiProject() + MULTI_PROJECT_MODULE.initialize(DK, 'DK') + MULTI_PROJECT_MODULE.initialize(SA, 'SA') + /* + Setting up external dependencies. + */ + SA.nodeModules = { + fs: require('fs'), + web3: require('web3'), + ws: require('ws'), + open: require('open'), + http: require('http'), + octokit: require("@octokit/rest"), + simpleGit: require('simple-git') + } + + /* + We will use this User Profile for Testing Purposes. + { + "githubUsername": "Test-Network-Client-Profile", + "address": "0xA0dCDA81b42C5EBDc45EC2875C72274B67560246", + "privateKey": "0x5fed4817a87431c8a328d0936561e63f45b6db289adac6125b9306ded644dfe9" + } + */ + + DK.TEST_NETWORK_CLIENT_USER_PROFILE_ID = "baa2f02c-2920-4edb-a103-d452fc61d82f" + DK.TEST_NETWORK_CLIENT_USER_PROFILE_HANDLE = "Test-Network-Client-Profile" + DK.TEST_NETWORK_CLIENT_USER_PROFILE_PRIVATE_KEY = "0x5fed4817a87431c8a328d0936561e63f45b6db289adac6125b9306ded644dfe9" + + run() + + async function run() { + DK.app = require('./Desktop/DesktopApp.js').newDesktopApp() + await DK.app.run() + console.log('Superalgos Desktop App is Running!') + } + } +} \ No newline at end of file diff --git a/NetworkRoot.js b/NetworkRoot.js new file mode 100644 index 000000000..075a6f6a7 --- /dev/null +++ b/NetworkRoot.js @@ -0,0 +1,65 @@ +exports.newNetworkRoot = function newNetworkRoot() { + /* + This module represents the execution root of the Network Node. + We use this module that is outside the Network folder to + load all node dependencies and get them ready to the actual node. + */ + let thisObject = { + run: run + } + + return thisObject + + async function run() { + /* + The NT object is accesible everywhere at the Superalgos Network. + It provides access to all modules built for this Network. + */ + global.NT = {} + /* + The SA object is accesible everywhere at the Superalgos Network. + It provides access to all modules built for Superalgos in general. + */ + global.SA = {} + /* Load Environment Variables */ + let ENVIRONMENT = require('./EnvironmentForDebug.js'); + let ENVIRONMENT_MODULE = ENVIRONMENT.newEnvironment() + global.env = ENVIRONMENT_MODULE + /* + First thing is to load the project schema file. + */ + global.PROJECTS_SCHEMA = require(global.env.PATH_TO_PROJECT_SCHEMA) + /* + Setting up the modules that will be available, defined at the Project Schema file. + */ + let MULTI_PROJECT = require('./MultiProject.js'); + let MULTI_PROJECT_MODULE = MULTI_PROJECT.newMultiProject() + MULTI_PROJECT_MODULE.initialize(NT, 'NT') + MULTI_PROJECT_MODULE.initialize(SA, 'SA') + /* + Setting up external dependencies. + */ + SA.nodeModules = { + fs: require('fs'), + nodeFetch: require('node-fetch'), + web3: require('web3'), + ws: require('ws') + } + + /* + We will use this User Profile for testing purposes. + { + "githubUsername": "Test-Network-Node-Profile", + "address": "0xa153469c57A91F5a59Fc6c45A37aD8dbad85e417", + "privateKey": "0xac498ae59407e6b68429a814f64da2339550f93a767578e28c161ff119159271" + } + */ + NT.NETWORK_NODE_USER_PROFILE_HANDLE = "Test-Network-Node-Profile" + NT.NETWORK_NODE_USER_PROFILE_PRIVATE_KEY = "0xac498ae59407e6b68429a814f64da2339550f93a767578e28c161ff119159271" + + NT.app = require('./Network/NetwokNode.js').newNetworkNode() + NT.app.run() + + console.log('Superalgos Network is Running.') + } +} \ No newline at end of file diff --git a/desktop.js b/desktop.js index a4ee44975..7354c18f8 100644 --- a/desktop.js +++ b/desktop.js @@ -7,65 +7,10 @@ The Superalgos Desktop is one of the 3 clients of the Superalgos Network: Users can unse any of these clients for their social trading activities. -This module is the starting point of the Superalgos Desktop App. +This module represents the Nodejs command that users have to start the Desktop App.. */ -/* -The DK object is accesible everywhere at the Superalgos Desktop App. -It provides access to all modules built for this App. -*/ -global.DK = {} -/* -The SA object is accesible everywhere at the Superalgos Desktop App. -It provides access to all modules built for Superalgos in general. -*/ -global.SA = {} -/* Load Environment Variables */ -let ENVIRONMENT = require('./EnvironmentForDebug.js'); -let ENVIRONMENT_MODULE = ENVIRONMENT.newEnvironment() -global.env = ENVIRONMENT_MODULE -/* -First thing is to load the project schema file. -*/ -global.PROJECTS_SCHEMA = require(global.env.PATH_TO_PROJECT_SCHEMA) -/* -Setting up the modules that will be available, defined at the Project Schema file. -*/ -let MULTI_PROJECT = require('./MultiProject.js'); -let MULTI_PROJECT_MODULE = MULTI_PROJECT.newMultiProject() -MULTI_PROJECT_MODULE.initialize(DK, 'DK') -MULTI_PROJECT_MODULE.initialize(SA, 'SA') -/* -Setting up external dependencies. -*/ -SA.nodeModules = { - fs: require('fs'), - web3: require('web3'), - ws: require('ws'), - open: require('open'), - http: require('http'), - octokit: require("@octokit/rest"), - simpleGit: require('simple-git') -} - -/* -We will use this User Profile for Testing Purposes. -{ - "githubUsername": "Test-Network-Client-Profile", - "address": "0xA0dCDA81b42C5EBDc45EC2875C72274B67560246", - "privateKey": "0x5fed4817a87431c8a328d0936561e63f45b6db289adac6125b9306ded644dfe9" -} -*/ - -DK.TEST_NETWORK_CLIENT_USER_PROFILE_ID = "baa2f02c-2920-4edb-a103-d452fc61d82f" -DK.TEST_NETWORK_CLIENT_USER_PROFILE_HANDLE = "Test-Network-Client-Profile" -DK.TEST_NETWORK_CLIENT_USER_PROFILE_PRIVATE_KEY = "0x5fed4817a87431c8a328d0936561e63f45b6db289adac6125b9306ded644dfe9" - -run() - -async function run() { - DK.app = require('./Desktop/DesktopApp.js').newDesktopApp() - await DK.app.run() - console.log('Superalgos Desktop App is Running!') -} +let APP_ROOT = require('./DesktopRoot.js') +let APP_ROOT_MODULE = APP_ROOT.newDesktopRoot() +APP_ROOT_MODULE.run() \ No newline at end of file diff --git a/network.js b/network.js index a0b0b2c33..53ea68d4b 100644 --- a/network.js +++ b/network.js @@ -7,57 +7,10 @@ The Superalgos Network offers 3 types of services: Users can decide which services to run at their node.(TODO) -This module is the starting point of the Network Node. +This module represents the Nodejs command that users have to start the Network Node.. */ -/* -The NT object is accesible everywhere at the Superalgos Network. -It provides access to all modules built for this Network. -*/ -global.NT = {} -/* -The SA object is accesible everywhere at the Superalgos Network. -It provides access to all modules built for Superalgos in general. -*/ -global.SA = {} -/* Load Environment Variables */ -let ENVIRONMENT = require('./EnvironmentForDebug.js'); -let ENVIRONMENT_MODULE = ENVIRONMENT.newEnvironment() -global.env = ENVIRONMENT_MODULE -/* -First thing is to load the project schema file. -*/ -global.PROJECTS_SCHEMA = require(global.env.PATH_TO_PROJECT_SCHEMA) -/* -Setting up the modules that will be available, defined at the Project Schema file. -*/ -let MULTI_PROJECT = require('./MultiProject.js'); -let MULTI_PROJECT_MODULE = MULTI_PROJECT.newMultiProject() -MULTI_PROJECT_MODULE.initialize(NT, 'NT') -MULTI_PROJECT_MODULE.initialize(SA, 'SA') -/* -Setting up external dependencies. -*/ -SA.nodeModules = { - fs: require('fs'), - nodeFetch: require('node-fetch'), - web3: require('web3'), - ws: require('ws') -} - -/* -We will use this User Profile for testing purposes. -{ - "githubUsername": "Test-Network-Node-Profile", - "address": "0xa153469c57A91F5a59Fc6c45A37aD8dbad85e417", - "privateKey": "0xac498ae59407e6b68429a814f64da2339550f93a767578e28c161ff119159271" -} -*/ -NT.NETWORK_NODE_USER_PROFILE_HANDLE = "Test-Network-Node-Profile" -NT.NETWORK_NODE_USER_PROFILE_PRIVATE_KEY = "0xac498ae59407e6b68429a814f64da2339550f93a767578e28c161ff119159271" - -NT.app = require('./Network/NetwokNode.js').newNetworkNode() -NT.app.run() - -console.log('Superalgos Network is Running.') \ No newline at end of file +let APP_ROOT = require('./NetworkRoot.js') +let APP_ROOT_MODULE = APP_ROOT.newNetworkRoot() +APP_ROOT_MODULE.run() \ No newline at end of file