Merge branch 'Superalgos:develop' into develop

This commit is contained in:
Nuno Amorim authored and GitHub committed 2021-11-24 22:28:19 +00:00
commit e67b535296
75 files changed
+2766 -1101

No files matched your search

+1 -1
View File
@@ -64,7 +64,7 @@ exports.newDesktopRoot = function newDesktopRoot() {
}
for (let i = 0; i < SA.secrets.array.length; i++) {
let secret = SA.secrets.array[i]
SA.secrets.map.set (secret.signingAccountChildCodeName, secret)
SA.secrets.map.set (secret.nodeCodeName, secret)
}
run()
+1
View File
@@ -28,6 +28,7 @@ exports.newEnvironment = function () {
PATH_TO_DESKTOP: './Desktop',
PATH_TO_DEFAULT_WORKSPACE: path.join(basePath, './Projects/Foundations/Plugins/Workspaces'),
PATH_TO_MY_WORKSPACES: path.join(basePath, './Platform/My-Workspaces'),
PATH_TO_SECRETS: path.join(basePath, './My-Secrets'),
PATH_TO_FONTS: path.join(basePath, './Platform/WebServer/Fonts'),
DESKTOP_APP_SIGNING_ACCOUNT: 'Social-Trading-Desktop-App-1',
DESKTOP_APP_MAX_OUTGOING_PEERS: 1,
+1 -1
View File
@@ -62,7 +62,7 @@ exports.newNetworkRoot = function newNetworkRoot() {
}
for (let i = 0; i < SA.secrets.array.length; i++) {
let secret = SA.secrets.array[i]
SA.secrets.map.set(secret.signingAccountChildCodeName, secret)
SA.secrets.map.set(secret.nodeCodeName, secret)
}
NT.app = require('./Network/NetwokNode.js').newNetworkNode()
+5
View File
@@ -367,6 +367,11 @@ exports.newGithubServer = function newGithubServer() {
if (await validateUserProfileBlockchainAccountDoesNotBelongtoAnotherUserProfile() === false) { continue }
if (await validateUserProfileSigningAccountsDoesNotBelongtoAnotherUserProfile() === false) { continue }
/*
TODO: We need to check before merging a User Profile that none of id of the node of the profile hierearchy exists at any other
User Profile already at the repository, to avoid atacts of users highjacking references of other user profiles.
*/
if (await mergePullRequest() === false) {
console.log('[WARN] Github Server -> mergeGithubPullRequests -> Merge Failed -> Pull Request "' + pullRequest.title + '" not merged because Github could not merge it. -> mergeResponse.message = ' + mergeResponse.data.message)
} else {
+166 -130
View File
@@ -139,7 +139,7 @@ exports.newHttpInterface = function newHttpInterface() {
return
}
default: {
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify({error: 'Method ' + params.method + ' is invalid.'}), httpResponse)
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify({ error: 'Method ' + params.method + ' is invalid.' }), httpResponse)
}
}
} catch (err) {
@@ -325,6 +325,42 @@ exports.newHttpInterface = function newHttpInterface() {
}
}
break
case 'Secrets': {
switch (requestPath[2]) { // switch by command
case 'Save-Secrets-File': {
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, httpResponse, processRequest)
async function processRequest(body) {
try {
let filePath = global.env.PATH_TO_SECRETS + '/'
let fileName = "Secrets.json"
createNewDir(filePath)
SA.nodeModules.fs.writeFileSync(filePath + '/' + fileName, body)
console.log('[SUCCESS] ' + filePath + '/' + fileName + ' created.')
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), httpResponse)
} catch (err) {
console.log('[ERROR] httpInterface -> Secrets -> Save-Secrets-File -> Method call produced an error.')
console.log('[ERROR] httpInterface -> Secrets -> Save-Secrets-File -> err.stack = ' + err.stack)
console.log('[ERROR] httpInterface -> Secrets -> Save-Secrets-File -> Params Received = ' + body)
let error = {
result: 'Fail Because',
message: err.message,
stack: err.stack
}
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(error), httpResponse)
}
}
break
}
}
}
break
case 'Docs': {
switch (requestPath[2]) { // switch by command
case 'Save-Node-Schema': {
@@ -633,16 +669,6 @@ exports.newHttpInterface = function newHttpInterface() {
}
}
}
function createNewDir(path) {
try {
fs.mkdirSync(path, {recursive: true})
} catch (err) {
if (err.message.indexOf('file already exists') < 0) {
throw (err)
}
}
}
}
return noErrorsDuringSaving
@@ -697,7 +723,7 @@ exports.newHttpInterface = function newHttpInterface() {
contribute()
async function contribute() {
const {lookpath} = SA.nodeModules.lookpath
const { lookpath } = SA.nodeModules.lookpath
const gitpath = await lookpath('git')
if (gitpath === undefined) {
console.log('[ERROR] `git` not installed.')
@@ -768,7 +794,7 @@ exports.newHttpInterface = function newHttpInterface() {
async function doGithub() {
const {Octokit} = SA.nodeModules.octokit
const { Octokit } = SA.nodeModules.octokit
const octokit = new Octokit({
auth: token,
@@ -832,7 +858,7 @@ exports.newHttpInterface = function newHttpInterface() {
update()
async function update() {
const {lookpath} = SA.nodeModules.lookpath
const { lookpath } = SA.nodeModules.lookpath
const gitpath = await lookpath('git');
if (gitpath === undefined) {
console.log('[ERROR] `git` not installed.')
@@ -873,11 +899,11 @@ exports.newHttpInterface = function newHttpInterface() {
let message
try {
message = await git.pull('https://github.com/Superalgos/Superalgos', currentBranch)
return {message: message}
return { message: message }
} catch (err) {
console.log('[ERROR] Error updating ' + currentBranch)
console.log(err.stack)
return {error: err}
return { error: err }
}
}
@@ -903,7 +929,7 @@ exports.newHttpInterface = function newHttpInterface() {
checkout()
async function checkout() {
const {lookpath} = SA.nodeModules.lookpath
const { lookpath } = SA.nodeModules.lookpath
const gitpath = await lookpath('git');
if (gitpath === undefined) {
console.log('[ERROR] `git` not installed.')
@@ -1001,7 +1027,7 @@ exports.newHttpInterface = function newHttpInterface() {
branch()
async function branch() {
const {lookpath} = SA.nodeModules.lookpath
const { lookpath } = SA.nodeModules.lookpath
const gitpath = await lookpath('git');
if (gitpath === undefined) {
console.log('[ERROR] `git` not installed.')
@@ -1354,7 +1380,7 @@ exports.newHttpInterface = function newHttpInterface() {
async function doGithubUser() {
const {Octokit} = SA.nodeModules.octokit
const { Octokit } = SA.nodeModules.octokit
const octokit = new Octokit({
auth: token,
@@ -1366,7 +1392,7 @@ exports.newHttpInterface = function newHttpInterface() {
const head = username + ':' + contributionsBranch
//const base = currentBranch
let base = undefined
if(process.env.SA_MODE === 'gitDisable') {
if (process.env.SA_MODE === 'gitDisable') {
base = 'develop'
} else {
base = currentBranch
@@ -1446,11 +1472,11 @@ exports.newHttpInterface = function newHttpInterface() {
async function getSHA(path) {
let sha = ''
const {graphql} = SA.nodeModules.graphql
const { graphql } = SA.nodeModules.graphql
try {
const {repository} = await graphql(
const { repository } = await graphql(
'{ ' +
' repository(name: "SuperAlgos", owner: "' + username + '") {' +
' object(expression: "develop:' + path + '") {' +
@@ -1535,7 +1561,7 @@ exports.newHttpInterface = function newHttpInterface() {
return
}
default: {
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify({error: 'Method ' + params.method + ' is invalid.'}), httpResponse)
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify({ error: 'Method ' + params.method + ' is invalid.' }), httpResponse)
}
}
} catch (err) {
@@ -1566,132 +1592,132 @@ exports.newHttpInterface = function newHttpInterface() {
}
break
case 'Images': // This means the Images folder.
{
let path = global.env.PATH_TO_PLATFORM + '/WebServer/Images/' + requestPath[2]
{
let path = global.env.PATH_TO_PLATFORM + '/WebServer/Images/' + requestPath[2]
if (requestPath[3] !== undefined) {
path = path + '/' + requestPath[3]
if (requestPath[3] !== undefined) {
path = path + '/' + requestPath[3]
}
if (requestPath[4] !== undefined) {
path = path + '/' + requestPath[4]
}
if (requestPath[5] !== undefined) {
path = path + '/' + requestPath[5]
}
path = unescape(path)
SA.projects.foundations.utilities.httpResponses.respondWithImage(path, httpResponse)
}
if (requestPath[4] !== undefined) {
path = path + '/' + requestPath[4]
}
if (requestPath[5] !== undefined) {
path = path + '/' + requestPath[5]
}
path = unescape(path)
SA.projects.foundations.utilities.httpResponses.respondWithImage(path, httpResponse)
}
break
case 'Icons': // This means the Icons folder under Projects.
{
let path = global.env.PATH_TO_PROJECTS + '/' + requestPath[2] + '/Icons'
{
let path = global.env.PATH_TO_PROJECTS + '/' + requestPath[2] + '/Icons'
if (requestPath[3] !== undefined) {
path = path + '/' + requestPath[3]
if (requestPath[3] !== undefined) {
path = path + '/' + requestPath[3]
}
if (requestPath[4] !== undefined) {
path = path + '/' + requestPath[4]
}
if (requestPath[5] !== undefined) {
path = path + '/' + requestPath[5]
}
path = unescape(path)
SA.projects.foundations.utilities.httpResponses.respondWithImage(path, httpResponse)
}
if (requestPath[4] !== undefined) {
path = path + '/' + requestPath[4]
}
if (requestPath[5] !== undefined) {
path = path + '/' + requestPath[5]
}
path = unescape(path)
SA.projects.foundations.utilities.httpResponses.respondWithImage(path, httpResponse)
}
break
case 'GIFs': // This means the GIFs folder under Projects.
{
let path = global.env.PATH_TO_PROJECTS + '/' + requestPath[2] + '/GIFs'
{
let path = global.env.PATH_TO_PROJECTS + '/' + requestPath[2] + '/GIFs'
if (requestPath[3] !== undefined) {
path = path + '/' + requestPath[3]
if (requestPath[3] !== undefined) {
path = path + '/' + requestPath[3]
}
if (requestPath[4] !== undefined) {
path = path + '/' + requestPath[4]
}
if (requestPath[5] !== undefined) {
path = path + '/' + requestPath[5]
}
path = unescape(path)
SA.projects.foundations.utilities.httpResponses.respondWithImage(path, httpResponse)
}
if (requestPath[4] !== undefined) {
path = path + '/' + requestPath[4]
}
if (requestPath[5] !== undefined) {
path = path + '/' + requestPath[5]
}
path = unescape(path)
SA.projects.foundations.utilities.httpResponses.respondWithImage(path, httpResponse)
}
break
case 'PNGs': // This means the PNGs folder under Projects.
{
let path = global.env.PATH_TO_PROJECTS + '/' + requestPath[2] + '/PNGs'
{
let path = global.env.PATH_TO_PROJECTS + '/' + requestPath[2] + '/PNGs'
if (requestPath[3] !== undefined) {
path = path + '/' + requestPath[3]
if (requestPath[3] !== undefined) {
path = path + '/' + requestPath[3]
}
if (requestPath[4] !== undefined) {
path = path + '/' + requestPath[4]
}
if (requestPath[5] !== undefined) {
path = path + '/' + requestPath[5]
}
path = unescape(path)
SA.projects.foundations.utilities.httpResponses.respondWithImage(path, httpResponse)
}
if (requestPath[4] !== undefined) {
path = path + '/' + requestPath[4]
}
if (requestPath[5] !== undefined) {
path = path + '/' + requestPath[5]
}
path = unescape(path)
SA.projects.foundations.utilities.httpResponses.respondWithImage(path, httpResponse)
}
break
case 'WebServer': // This means the WebServer folder.
{
SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_PLATFORM + '/WebServer/' + requestPath[2], httpResponse)
}
{
SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_PLATFORM + '/WebServer/' + requestPath[2], httpResponse)
}
break
case 'externalScripts': // This means the WebServer folder.
{
// This allows to have sub-folders in externalScripts
let fullPath = ''
for (let i = 2; i < requestPath.length; i++) {
fullPath += requestPath[i]
if (i !== requestPath.length - 1) {
fullPath += '/'
{
// This allows to have sub-folders in externalScripts
let fullPath = ''
for (let i = 2; i < requestPath.length; i++) {
fullPath += requestPath[i]
if (i !== requestPath.length - 1) {
fullPath += '/'
}
}
/**
* Sometimes libs will call fonts/images etc. by themselves thus we should have a filter for file type to respond with the correct content and headers, but from the externalScripts folder
* This code should be improved when needed with specific file types
*/
let requestedFileExtension = requestPath[requestPath.length - 1].split('.').pop()
switch (requestedFileExtension) {
case 'otf':
case 'ttf':
case 'eot':
case 'woff':
case 'woff2':
SA.projects.foundations.utilities.httpResponses.respondWithFont(global.env.PATH_TO_PLATFORM + '/WebServer/externalScripts/' + fullPath, httpResponse)
break
default:
SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_PLATFORM + '/WebServer/externalScripts/' + fullPath, httpResponse)
}
}
/**
* Sometimes libs will call fonts/images etc. by themselves thus we should have a filter for file type to respond with the correct content and headers, but from the externalScripts folder
* This code should be improved when needed with specific file types
*/
let requestedFileExtension = requestPath[requestPath.length - 1].split('.').pop()
switch (requestedFileExtension) {
case 'otf':
case 'ttf':
case 'eot':
case 'woff':
case 'woff2':
SA.projects.foundations.utilities.httpResponses.respondWithFont(global.env.PATH_TO_PLATFORM + '/WebServer/externalScripts/' + fullPath, httpResponse)
break
default:
SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_PLATFORM + '/WebServer/externalScripts/' + fullPath, httpResponse)
}
}
break
case 'Plotters': // This means the plotter folder, not to be confused with the Plotters script!
{
let project = requestPath[2]
let dataMine = requestPath[3]
let codeName = requestPath[4]
let moduleName = requestPath[5]
let filePath = global.env.PATH_TO_PROJECTS + '/' + project + '/' + 'Bots-Plotters-Code' + '/' + dataMine + '/plotters/' + codeName + '/' + moduleName
SA.projects.foundations.utilities.httpResponses.respondWithFile(filePath, httpResponse)
}
{
let project = requestPath[2]
let dataMine = requestPath[3]
let codeName = requestPath[4]
let moduleName = requestPath[5]
let filePath = global.env.PATH_TO_PROJECTS + '/' + project + '/' + 'Bots-Plotters-Code' + '/' + dataMine + '/plotters/' + codeName + '/' + moduleName
SA.projects.foundations.utilities.httpResponses.respondWithFile(filePath, httpResponse)
}
break
case 'ChartLayers': {
SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_PLATFORM + '/UI/' + endpointOrFile + '/' + requestPath[2], httpResponse)
@@ -1889,8 +1915,8 @@ exports.newHttpInterface = function newHttpInterface() {
fileName
)
.then(response => {
SA.projects.foundations.utilities.httpResponses.respondWithContent(response, httpResponse)
}
SA.projects.foundations.utilities.httpResponses.respondWithContent(response, httpResponse)
}
)
.catch(err => {
let error = {
@@ -2070,7 +2096,7 @@ exports.newHttpInterface = function newHttpInterface() {
/* Create Dir if it does not exist */
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir, {recursive: true});
fs.mkdirSync(dir, { recursive: true });
}
fs.writeFile(filePath, fileContent, onFileWritten)
@@ -2214,4 +2240,14 @@ exports.newHttpInterface = function newHttpInterface() {
}
}
}
function createNewDir(path) {
try {
SA.nodeModules.fs.mkdirSync(path, { recursive: true })
} catch (err) {
if (err.message.indexOf('file already exists') < 0) {
throw (err)
}
}
}
}
@@ -150,7 +150,7 @@ exports.newAlgorithmicTradingBotModulesSnapshots = function(processIndex) {
}
/* Now we go down through all this node children */
let schemaDocument = TS.projects.foundations.globals.taskConstants.APP_SCHEMA_MAP.get(node.project + '-' + node.type)
let schemaDocument = SA.projects.foundations.globals.schemas.APP_SCHEMA_MAP.get(node.project + '-' + node.type)
if (schemaDocument === undefined) { return }
if (schemaDocument.childrenNodesProperties !== undefined) {
@@ -112,7 +112,7 @@ exports.newAlgorithmicTradingBotModulesTradingEngine = function (processIndex) {
destinationNode.value = originNode.value
/* Now we go down through all the children of the origin node, assuming the destination node has the same children structure*/
let schemaDocument = TS.projects.foundations.globals.taskConstants.APP_SCHEMA_MAP.get(originNode.project + '-' + originNode.type)
let schemaDocument = SA.projects.foundations.globals.schemas.APP_SCHEMA_MAP.get(originNode.project + '-' + originNode.type)
if (schemaDocument === undefined) { return }
if (schemaDocument.childrenNodesProperties !== undefined) {
@@ -151,7 +151,7 @@ exports.newAlgorithmicTradingBotModulesTradingEngine = function (processIndex) {
nodesMap.set(node.id, node)
/* Now we go down through all this node children */
let schemaDocument = TS.projects.foundations.globals.taskConstants.APP_SCHEMA_MAP.get(node.project + '-' + node.type)
let schemaDocument = SA.projects.foundations.globals.schemas.APP_SCHEMA_MAP.get(node.project + '-' + node.type)
if (schemaDocument === undefined) { return }
if (schemaDocument.childrenNodesProperties !== undefined) {
@@ -194,7 +194,7 @@ exports.newAlgorithmicTradingBotModulesTradingEngine = function (processIndex) {
}
/* Now we go down through all this node children */
let schemaDocument = TS.projects.foundations.globals.taskConstants.APP_SCHEMA_MAP.get(node.project + '-' + node.type)
let schemaDocument = SA.projects.foundations.globals.schemas.APP_SCHEMA_MAP.get(node.project + '-' + node.type)
if (schemaDocument === undefined) { return }
if (schemaDocument.childrenNodesProperties !== undefined) {
@@ -31,7 +31,7 @@ exports.newAlgorithmicTradingBotModulesTradingOutput = function (processIndex) {
/* Preparing everything for the Simulation */
let tradingSimulationModuleObject = TS.projects.algorithmicTrading.botModules.tradingSimulation.newAlgorithmicTradingBotModulesTradingSimulation(processIndex)
let outputDatasets = TS.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processOutput, 'Output Dataset')
let outputDatasets = SA.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processOutput, 'Output Dataset')
let outputDatasetsMap = new Map()
await TS.projects.foundations.functionLibraries.outputManagementFunctions.readFiles(
@@ -37,7 +37,7 @@ exports.newAlgorithmicTradingBotModulesTradingRecords = function (processIndex)
we have a pointer to the node that have the information we need to extract.
Later, based on the product record definition we will extract each individual value.
*/
let outputDatasets = TS.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processOutput, 'Output Dataset')
let outputDatasets = SA.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processOutput, 'Output Dataset')
for (let i = 0; i < outputDatasets.length; i++) {
let outputDatasetNode = outputDatasets[i]
@@ -372,8 +372,8 @@ exports.newAlgorithmicTradingBotModulesTradingSimulation = function (processInde
}
function positionChart(chart) {
let dataDependencies = TS.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processDependencies, 'Data Dependency')
dataDependencies = TS.projects.visualScripting.utilities.nodeFunctions.filterOutNodeWihtoutReferenceParentFromNodeArray(dataDependencies)
let dataDependencies = SA.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processDependencies, 'Data Dependency')
dataDependencies = SA.projects.visualScripting.utilities.nodeFunctions.filterOutNodeWihtoutReferenceParentFromNodeArray(dataDependencies)
/* Finding the Current Element on Daily Files */
if (TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).TRADING_PROCESSING_DAILY_FILES) {
@@ -272,7 +272,7 @@ exports.newAlgorithmicTradingBotModulesTradingSystem = function (processIndex) {
}
/* Now we go down through all this node children */
let schemaDocument = TS.projects.foundations.globals.taskConstants.APP_SCHEMA_MAP.get(node.project + '-' + node.type)
let schemaDocument = SA.projects.foundations.globals.schemas.APP_SCHEMA_MAP.get(node.project + '-' + node.type)
if (schemaDocument === undefined) { return }
if (schemaDocument.childrenNodesProperties !== undefined) {
@@ -201,7 +201,7 @@ exports.newDataMiningBotModulesFetchingProcess = function (processIndex) {
if (recordProperty.apiResponseFieldReference !== undefined) {
if (recordProperty.apiResponseFieldReference.referenceParent !== undefined) {
let apiResponseField = recordProperty.apiResponseFieldReference.referenceParent
let endpointNodeFound = TS.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(apiResponseField, 'API Endpoint')
let endpointNodeFound = SA.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(apiResponseField, 'API Endpoint')
/*
Every Record Property with an apiResponseFieldReference must be on the path
to a certain endpoint.
@@ -52,13 +52,13 @@
}
/* The first phase here is about checking that we have everything we need at the definition level. */
let dataDependencies = TS.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(
let dataDependencies = SA.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(
TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processDependencies, 'Data Dependency'
)
if (TS.projects.foundations.functionLibraries.singleMarketFunctions.validateDataDependencies(processIndex, dataDependencies, callBackFunction) !== true) { return }
let outputDatasets = TS.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(
let outputDatasets = SA.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(
TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processOutput, 'Output Dataset'
)
if (TS.projects.foundations.functionLibraries.singleMarketFunctions.validateOutputDatasets(processIndex, outputDatasets, callBackFunction) !== true) { return }
@@ -138,9 +138,9 @@
contextSummary.dataset = outputDatasetNode.referenceParent.config.codeName
contextSummary.product = outputDatasetNode.referenceParent.parentNode.config.codeName
let botNode = TS.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(outputDatasetNode, 'Indicator Bot')
let botNode = SA.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(outputDatasetNode, 'Indicator Bot')
contextSummary.bot = botNode.config.codeName
let dataMineNode = TS.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(outputDatasetNode, 'Data Mine')
let dataMineNode = SA.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(outputDatasetNode, 'Data Mine')
contextSummary.dataMine = dataMineNode.config.codeName
contextSummary.mineType = dataMineNode.type.replace(' ', '-')
contextSummary.project = dataMineNode.project
@@ -513,7 +513,7 @@
}
function writeDataRanges(callBack) {
let outputDatasets = TS.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(
let outputDatasets = SA.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(
TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processOutput, 'Output Dataset')
let outputDatasetIndex = -1;
controlLoop()
@@ -151,7 +151,7 @@
function writeTimeFramesFiles(callBack) {
let outputDatasets =
TS.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processOutput, 'Output Dataset')
SA.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processOutput, 'Output Dataset')
let outputDatasetIndex = -1;
controlLoop()
@@ -0,0 +1,8 @@
exports.newFoundationsGlobalsSchemas = function () {
let thisObject = {
APP_SCHEMA_MAP: new Map()
}
return thisObject
}
@@ -375,14 +375,14 @@ exports.newFoundationsFunctionLibrariesDataDependenciesFunctions = function () {
THe first thing we do is to build an array of all the
declared dependencies of the Bot Process.
*/
let dataDependencies = TS.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processDependencies, 'Data Dependency')
let dataDependencies = SA.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processDependencies, 'Data Dependency')
/*
Then we will filter out declared dependencies that are
not referencing nodes currently present at the workspace.
This will allow the user to have less Data Mines loaded at
the workspace that the ones that a the Bot process depends on.
*/
dataDependencies = TS.projects.visualScripting.utilities.nodeFunctions.filterOutNodeWihtoutReferenceParentFromNodeArray(dataDependencies)
dataDependencies = SA.projects.visualScripting.utilities.nodeFunctions.filterOutNodeWihtoutReferenceParentFromNodeArray(dataDependencies)
/*
We will run some validations to prevent starting the process
if all needed config and nodes are not present.
@@ -394,7 +394,7 @@ exports.newFoundationsFunctionLibrariesDataDependenciesFunctions = function () {
we do it just to be able to validate that all nodes and config
are ok before letting this process run too far.
*/
let outputDatasets = TS.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processOutput, 'Output Dataset')
let outputDatasets = SA.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processOutput, 'Output Dataset')
/*
Here we check that all output datasets configs are ok.
*/
@@ -48,7 +48,7 @@ exports.newFoundationsFunctionLibrariesFromOneMinToMultiTimeFrameFunctions = fun
node.dataDependency = dataDependenciesModule.curatedDependencyNodeArray[0]
}
let outputDatasets = TS.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(
let outputDatasets = SA.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(
TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processOutput, 'Output Dataset'
)
@@ -123,7 +123,7 @@ exports.newFoundationsFunctionLibrariesProcessFilesFunctions = function () {
async function writeProcessFiles(processIndex, contextVariables, currentTimeFrame, processDate, statusDependencies) {
let fileStorage = TS.projects.foundations.taskModules.fileStorage.newFileStorage(processIndex)
let outputDatasets = TS.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processOutput, 'Output Dataset')
let outputDatasets = SA.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processOutput, 'Output Dataset')
await writeTimeFramesFiles()
await writeDataRanges()
@@ -91,12 +91,12 @@
return
}
let botNode = TS.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(outputDatasetNode, 'Indicator Bot')
let botNode = SA.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(outputDatasetNode, 'Indicator Bot')
if (botNode === undefined) {
botNode = TS.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(outputDatasetNode, 'Trading Bot')
botNode = SA.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(outputDatasetNode, 'Trading Bot')
}
if (botNode === undefined) {
botNode = TS.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(outputDatasetNode, 'Learning Bot')
botNode = SA.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(outputDatasetNode, 'Learning Bot')
}
if (botNode === undefined) {
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[ERROR] start -> Product Definition not attached to a Bot. ");
@@ -110,11 +110,11 @@
return
}
let dataMineNode = TS.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(outputDatasetNode, 'Data Mine')
let dataMineNode = SA.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(outputDatasetNode, 'Data Mine')
if (dataMineNode === undefined) {
let tradingMineNode = TS.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(outputDatasetNode, 'Trading Mine')
let tradingMineNode = SA.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(outputDatasetNode, 'Trading Mine')
if (tradingMineNode === undefined) {
let learningMineNode = TS.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(outputDatasetNode, 'Learning Mine')
let learningMineNode = SA.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(outputDatasetNode, 'Learning Mine')
if (learningMineNode === undefined) {
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[ERROR] start -> Bot not attached to a Data Mine, Trading Mine or Learning Mine.");
callBackFunction(TS.projects.foundations.globals.standardResponses.DEFAULT_FAIL_RESPONSE);
@@ -8,7 +8,6 @@ exports.newFoundationsGlobalsTaskConstants = function () {
NETWORK_NODE: undefined,
PROJECT_DEFINITION_NODE: undefined,
PROJECTS_SCHEMA: undefined,
APP_SCHEMA_MAP: new Map(),
EVENT_SERVER_CLIENT_MODULE_OBJECT: undefined, // This is an instance of the Event Server Client pointing to the localhost server
TASK_HEARTBEAT_INTERVAL_HANDLER: undefined
}
@@ -50,7 +50,7 @@
/*
First we will get all the data dependencies of the bot, as defined at the Trading Mine.
*/
thisObject.curatedDependencyNodeArray = TS.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processDependencies, 'Data Dependency')
thisObject.curatedDependencyNodeArray = SA.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processDependencies, 'Data Dependency')
if (thisObject.curatedDependencyNodeArray.length === 0) {
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[ERROR] initialize -> onInitilized -> It is not possible to not have data dependencies at all.")
callBackFunction(TS.projects.foundations.globals.standardResponses.DEFAULT_FAIL_RESPONSE)
@@ -61,7 +61,7 @@
This will allow the user to have less Data Mines loaded at the workspace
that the ones that a Trading Mine depends on.
*/
thisObject.curatedDependencyNodeArray = TS.projects.visualScripting.utilities.nodeFunctions.filterOutNodeWihtoutReferenceParentFromNodeArray(thisObject.curatedDependencyNodeArray)
thisObject.curatedDependencyNodeArray = SA.projects.visualScripting.utilities.nodeFunctions.filterOutNodeWihtoutReferenceParentFromNodeArray(thisObject.curatedDependencyNodeArray)
} else {
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[ERROR] initialize -> onInitilized -> It is not possible not to have process dependencies, which means not data dependencies.")
@@ -222,7 +222,7 @@ exports.newFoundationsProcessModulesDataset = function (processIndex) {
function scanNodeMesh(startingNode) {
if (startingNode === undefined) { return }
let schemaDocument = TS.projects.foundations.globals.taskConstants.APP_SCHEMA_MAP.get(startingNode.project + '-' + startingNode.type)
let schemaDocument = SA.projects.foundations.globals.schemas.APP_SCHEMA_MAP.get(startingNode.project + '-' + startingNode.type)
if (schemaDocument === undefined) { return }
if (startingNode.id === productDefinition.id) {
@@ -18,23 +18,23 @@
/* We will raise the events for the datasets impacted by the process that just finished. */
if (TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processOutput !== undefined) {
let outputDatasets = TS.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processOutput, 'Output Dataset')
let outputDatasets = SA.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processOutput, 'Output Dataset')
for (let j = 0; j < outputDatasets.length; j++) {
let outputDataset = outputDatasets[j]
let botNode = TS.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(outputDataset, 'Indicator Bot')
let botNode = SA.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(outputDataset, 'Indicator Bot')
if (botNode === undefined) {
botNode = TS.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(outputDataset, 'Trading Bot')
botNode = SA.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(outputDataset, 'Trading Bot')
}
if (botNode === undefined) {
botNode = TS.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(outputDataset, 'Sensor Bot')
botNode = SA.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(outputDataset, 'Sensor Bot')
}
if (botNode === undefined) {
botNode = TS.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(outputDataset, 'API Data Fetcher Bot')
botNode = SA.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(outputDataset, 'API Data Fetcher Bot')
}
if (botNode === undefined) {
botNode = TS.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(outputDataset, 'Learning Bot')
botNode = SA.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(outputDataset, 'Learning Bot')
}
/* Some validations to verify that everything is in place. */
@@ -112,23 +112,23 @@
function asyncRaiseEvents(lastFile, timeFrames) {
if (TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processOutput !== undefined) {
let outputDatasets = TS.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processOutput, 'Output Dataset')
let outputDatasets = SA.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processOutput, 'Output Dataset')
for (let j = 0; j < outputDatasets.length; j++) {
let outputDataset = outputDatasets[j]
let botNode = TS.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(outputDataset, 'Indicator Bot')
let botNode = SA.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(outputDataset, 'Indicator Bot')
if (botNode === undefined) {
botNode = TS.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(outputDataset, 'Trading Bot')
botNode = SA.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(outputDataset, 'Trading Bot')
}
if (botNode === undefined) {
botNode = TS.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(outputDataset, 'Sensor Bot')
botNode = SA.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(outputDataset, 'Sensor Bot')
}
if (botNode === undefined) {
botNode = TS.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(outputDataset, 'API Data Fetcher Bot')
botNode = SA.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(outputDataset, 'API Data Fetcher Bot')
}
if (botNode === undefined) {
botNode = TS.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(outputDataset, 'Learning Bot')
botNode = SA.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(outputDataset, 'Learning Bot')
}
/* Some validations to verify that everything is in place. */
@@ -1,90 +0,0 @@
function newFoundationsFunctionLibrarySuperScriptsFunctions() {
let thisObject = {
runSuperScript: runSuperScript
}
return thisObject
function runSuperScript(node, rootNodes) {
try {
let clone = UI.projects.visualScripting.functionLibraries.nodeCloning.getNodeClone
let executionResult = true
let superAction = node
function setup(templateClone, target, exchange, exchangeNodeType, arrayPropertyName) {
spawnPosition.x = target.payload.position.x
spawnPosition.y = target.payload.position.y
if (exchange === undefined) {
UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.createUiObjectFromNode(templateClone, target, target)
} else {
let definition = getSchemaDocument(target)
for (let i = 0; i < definition.childrenNodesProperties.length; i++) {
let property = definition.childrenNodesProperties[i]
if (property.childType === exchangeNodeType) {
let exchanges = target[property.name]
if (exchanges === undefined) {
exchanges = []
}
let targetExchange
for (let j = 0; j < exchanges.length; j++) {
let thisExchange = exchanges[j]
if (thisExchange.payload.referenceParent !== undefined) {
if (thisExchange.payload.referenceParent.id === exchange.id) {
targetExchange = thisExchange
}
}
}
if (targetExchange === undefined) {
targetExchange = UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.addUIObject(target, exchangeNodeType)
UI.projects.visualScripting.functionLibraries.attachDetach.referenceAttachNode(targetExchange, exchange)
}
let nodesArray = targetExchange[arrayPropertyName]
nodesArray.push(templateClone)
UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.createUiObjectFromNode(templateClone, targetExchange, targetExchange)
}
}
}
}
function deleteNode(node) {
UI.projects.visualScripting.functionLibraries.nodeDeleter.deleteUIObject(node, rootNodes)
}
/* Validations */
if (executionResult === true && node.payload.parentNode === undefined) {
node.payload.uiObject.setErrorMessage('Super Action node needs a Parent Node.')
executionResult = false
}
if (executionResult === true && node.payload.referenceParent === undefined) {
node.payload.uiObject.setErrorMessage('Super Action node needs to reference a Master Script Node.')
executionResult = false
}
if (executionResult === true && node.payload.referenceParent.javascriptCode === undefined) {
node.payload.uiObject.setErrorMessage('Master Script Node needs to have a child Javascript Code Node.')
executionResult = false
}
let masterScript = node.payload.referenceParent
eval(masterScript.javascriptCode.code)
let masterScriptInstance = newNewMasterScriptInstance()
if (executionResult === true) {
executionResult = masterScriptInstance.runValidations(superAction, masterScript)
}
if (executionResult === true) {
executionResult = masterScriptInstance.runScript(superAction, masterScript)
}
if (executionResult === true) {
superAction.payload.uiObject.setValue('Execution Completed Successfully')
} else {
superAction.payload.uiObject.setValue('Execution Failed')
}
} catch (err) {
superAction.payload.uiObject.setErrorMessage(err.message)
superAction.payload.uiObject.setValue('Execution Failed')
}
}
}
@@ -332,7 +332,7 @@ function newFoundationsCodeEditorEditorPage() {
})
// Enrich chart data with market and exchange structure
UI.projects.foundations.spaces.designSpace.workspace.workspaceNode.rootNodes.forEach(node => {
/* UI.projects.foundations.spaces.designSpace.workspace.workspaceNode.rootNodes.forEach(node => {
if (node.type === 'Crypto Ecosystem') {
node.cryptoExchanges.forEach(cxs => {
cxs.exchanges.forEach(exchange => {
@@ -342,19 +342,21 @@ function newFoundationsCodeEditorEditorPage() {
let baseAsset = marketPair.split('/')[0]
let quotedAsset = marketPair.split('/')[1]
stringObjects.forEach(chartObj => {
/**
/!**
* We will provide auto-complete only for assets pair found in Markets
* Doing so we will avoid providing completion for assets that are not used in a market
*/
*!/
//TODO: Disabled on purpose, causes high memory consumption when multiple exchanges are loaded
let market = marketPrefix + baseAsset + dot + quotedAsset + dot + chartObj
stringObjects.push(market)
stringObjects.push(exchangePrefix + exchangeName + dot + market)
// stringObjects.push(market)
// stringObjects.push(exchangePrefix + exchangeName + dot + market)
})
})
})
})
}
})
})*/
//Actually building the objects for chart, market and exchange, no need for multiple objects, as one is enough for the autocomplete to work
stringObjects.forEach(stringRepresentation => {
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

File diff suppressed because it is too large. Load diff
@@ -25,13 +25,13 @@
"config": true
},
"initialValues": {
"config": "{}"
"config": "{ \n\"codeName\": \"localhost\", \n\"host\": \"localhost\", \n\"webPort\": \"34248\", \n\"webSocketsPort\": \"18041\"\n}"
},
"addLeftIcons": true,
"level": 1,
"attachingRules": {
"compatibleTypes": "->Signing Account->"
"compatibleTypes": "->Desktop Apps->"
},
"childrenNodesProperties": [],
"propertyNameAtParent": "signingAccountChild"
"propertyNameAtParent": "algoTradesPlatform"
}
@@ -0,0 +1,64 @@
{
"type": "Desktop Apps",
"menuItems": [
{
"action": "Configure",
"actionFunction": "uiObject.configEditor.activate",
"label": "Configure",
"iconPathOn": "configuration",
"iconPathOff": "configuration"
},
{
"action": "Add UI Object",
"actionProject": "Visual-Scripting",
"actionFunction": "payload.executeAction",
"label": "Add Social Trading Desktop App",
"relatedUiObject": "Social Trading Desktop App",
"relatedUiObjectProject": "Governance"
},
{
"action": "Add UI Object",
"actionProject": "Visual-Scripting",
"actionFunction": "payload.executeAction",
"label": "Add Algo Traders Platform",
"relatedUiObject": "Algo Traders Platform",
"relatedUiObjectProject": "Governance"
},
{
"action": "Delete UI Object",
"actionProject": "Visual-Scripting",
"askConfirmation": true,
"confirmationLabel": "Confirm to Delete",
"label": "Delete",
"iconPathOn": "delete-entity",
"iconPathOff": "delete-entity",
"actionFunction": "payload.executeAction"
}
],
"editors": {
"config": true
},
"initialValues": {
"config": "{}"
},
"addLeftIcons": true,
"level": 2,
"attachingRules": {
"compatibleTypes": "->User Apps->"
},
"propertyNameAtParent": "desktopApps",
"childrenNodesProperties": [
{
"name": "socialTradingDesktopApps",
"type": "array",
"childType": "Social Trading Desktop App",
"autoAdd": false
},
{
"name": "algoTradesPlatform",
"type": "array",
"childType": "Algo Traders Platform",
"autoAdd": false
}
]
}
@@ -0,0 +1,50 @@
{
"type": "Mobile Apps",
"menuItems": [
{
"action": "Configure",
"actionFunction": "uiObject.configEditor.activate",
"label": "Configure",
"iconPathOn": "configuration",
"iconPathOff": "configuration"
},
{
"action": "Add UI Object",
"actionProject": "Visual-Scripting",
"actionFunction": "payload.executeAction",
"label": "Add Social Trading Mobile App",
"relatedUiObject": "Social Trading Mobile App",
"relatedUiObjectProject": "Governance"
},
{
"action": "Delete UI Object",
"actionProject": "Visual-Scripting",
"askConfirmation": true,
"confirmationLabel": "Confirm to Delete",
"label": "Delete",
"iconPathOn": "delete-entity",
"iconPathOff": "delete-entity",
"actionFunction": "payload.executeAction"
}
],
"editors": {
"config": true
},
"initialValues": {
"config": "{}"
},
"addLeftIcons": true,
"level": 2,
"attachingRules": {
"compatibleTypes": "->User Apps->"
},
"propertyNameAtParent": "mobileApps",
"childrenNodesProperties": [
{
"name": "socialTradingMobileApps",
"type": "array",
"childType": "Social Trading Mobile App",
"autoAdd": false
}
]
}
@@ -30,8 +30,8 @@
"addLeftIcons": true,
"level": 1,
"attachingRules": {
"compatibleTypes": "->Signing Account->"
"compatibleTypes": "->P2P Network Nodes->"
},
"childrenNodesProperties": [],
"propertyNameAtParent": "signingAccountChild"
"propertyNameAtParent": "p2pNetworkNodes"
}
@@ -0,0 +1,50 @@
{
"type": "P2P Network Nodes",
"menuItems": [
{
"action": "Configure",
"actionFunction": "uiObject.configEditor.activate",
"label": "Configure",
"iconPathOn": "configuration",
"iconPathOff": "configuration"
},
{
"action": "Add UI Object",
"actionProject": "Visual-Scripting",
"actionFunction": "payload.executeAction",
"label": "Add P2P Network Node",
"relatedUiObject": "P2P Network Node",
"relatedUiObjectProject": "Governance"
},
{
"action": "Delete UI Object",
"actionProject": "Visual-Scripting",
"askConfirmation": true,
"confirmationLabel": "Confirm to Delete",
"label": "Delete",
"iconPathOn": "delete-entity",
"iconPathOff": "delete-entity",
"actionFunction": "payload.executeAction"
}
],
"editors": {
"config": true
},
"initialValues": {
"config": "{}"
},
"addLeftIcons": true,
"level": 2,
"attachingRules": {
"compatibleTypes": "->User Profile->"
},
"propertyNameAtParent": "p2pNetworkNodes",
"childrenNodesProperties": [
{
"name": "p2pNetworkNodes",
"type": "array",
"childType": "P2P Network Node",
"autoAdd": false
}
]
}
@@ -20,53 +20,9 @@
"relatedUiObjectProject": "Governance"
},
{
"action": "Add Social Trading Desktop App",
"action": "Install Secrets",
"actionProject": "Governance",
"label": "Add Social Trading Desktop App",
"askConfirmation": true,
"confirmationLabel": "Confirm to Proceed",
"workDoneLabel": "Done",
"relatedUiObject": "Profile Constructor",
"actionFunction": "payload.executeAction",
"relatedUiObjectProject": "Governance"
},
{
"action": "Add Social Trading Server App",
"actionProject": "Governance",
"label": "Add Social Trading Server App",
"askConfirmation": true,
"confirmationLabel": "Confirm to Proceed",
"workDoneLabel": "Done",
"relatedUiObject": "Profile Constructor",
"actionFunction": "payload.executeAction",
"relatedUiObjectProject": "Governance"
},
{
"action": "Add Social Trading Mobile App",
"actionProject": "Governance",
"label": "Add Social Trading Mobile App",
"askConfirmation": true,
"confirmationLabel": "Confirm to Proceed",
"workDoneLabel": "Done",
"relatedUiObject": "Profile Constructor",
"actionFunction": "payload.executeAction",
"relatedUiObjectProject": "Governance"
},
{
"action": "Add Algo Traders Platform",
"actionProject": "Governance",
"label": "Add Algo Traders Platform",
"askConfirmation": true,
"confirmationLabel": "Confirm to Proceed",
"workDoneLabel": "Done",
"relatedUiObject": "Profile Constructor",
"actionFunction": "payload.executeAction",
"relatedUiObjectProject": "Governance"
},
{
"action": "Add P2P Network Node",
"actionProject": "Governance",
"label": "Add P2P Network Node",
"label": "Install Secrets",
"askConfirmation": true,
"confirmationLabel": "Confirm to Proceed",
"workDoneLabel": "Done",
@@ -0,0 +1,50 @@
{
"type": "Server Apps",
"menuItems": [
{
"action": "Configure",
"actionFunction": "uiObject.configEditor.activate",
"label": "Configure",
"iconPathOn": "configuration",
"iconPathOff": "configuration"
},
{
"action": "Add UI Object",
"actionProject": "Visual-Scripting",
"actionFunction": "payload.executeAction",
"label": "Add Social Trading Server App",
"relatedUiObject": "Social Trading Server App",
"relatedUiObjectProject": "Governance"
},
{
"action": "Delete UI Object",
"actionProject": "Visual-Scripting",
"askConfirmation": true,
"confirmationLabel": "Confirm to Delete",
"label": "Delete",
"iconPathOn": "delete-entity",
"iconPathOff": "delete-entity",
"actionFunction": "payload.executeAction"
}
],
"editors": {
"config": true
},
"initialValues": {
"config": "{}"
},
"addLeftIcons": true,
"level": 2,
"attachingRules": {
"compatibleTypes": "->User Apps->"
},
"propertyNameAtParent": "serverApps",
"childrenNodesProperties": [
{
"name": "socialTradingServerApps",
"type": "array",
"childType": "Social Trading Server App",
"autoAdd": false
}
]
}
@@ -25,6 +25,9 @@
"attachingRules": {
"compatibleTypes": "->Signing Accounts->"
},
"referencingRules": {
"compatibleTypes": "->P2P Network Node->Algo Traders Platform->Social Trading Mobile App->Social Trading Desktop App->Social Trading Server App->"
},
"editors": {
"config": true
},
@@ -32,36 +35,8 @@
"config": "{}"
},
"propertyNameAtParent": "signingAccounts",
"childrenNodesProperties": [
{
"name": "signingAccountChild",
"type": "node",
"childType": "P2P Network Node",
"autoAdd": false
},
{
"name": "signingAccountChild",
"type": "node",
"childType": "Algo Traders Platform",
"autoAdd": false
},
{
"name": "signingAccountChild",
"type": "node",
"childType": "Social Trading Mobile App",
"autoAdd": false
},
{
"name": "signingAccountChild",
"type": "node",
"childType": "Social Trading Desktop App",
"autoAdd": false
},
{
"name": "signingAccountChild",
"type": "node",
"childType": "Social Trading Server App",
"autoAdd": false
}
"childrenNodesProperties": [],
"title": [
"Use Reference Parent"
]
}
@@ -0,0 +1,42 @@
{
"type": "Social Persona Followed",
"menuItems": [
{
"action": "Configure",
"actionFunction": "uiObject.configEditor.activate",
"label": "Configure",
"iconPathOn": "configuration",
"iconPathOff": "configuration"
},
{
"action": "Delete UI Object",
"actionProject": "Visual-Scripting",
"askConfirmation": true,
"confirmationLabel": "Confirm to Delete",
"label": "Delete",
"iconPathOn": "delete-entity",
"iconPathOff": "delete-entity",
"actionFunction": "payload.executeAction"
}
],
"editors": {
"config": true
},
"initialValues": {
"config": "{}"
},
"addLeftIcons": true,
"level": 2,
"attachingRules": {
"compatibleTypes": "->Social Personas Following->"
},
"referencingRules": {
"compatibleTypes": "->Social Persona->"
},
"propertyNameAtParent": "socialPersonasFollowed",
"childrenNodesProperties": [
],
"title": [
"Use Reference Parent"
]
}
@@ -0,0 +1,52 @@
{
"type": "Social Persona",
"menuItems": [
{
"action": "Configure",
"actionFunction": "uiObject.configEditor.activate",
"label": "Configure",
"iconPathOn": "configuration",
"iconPathOff": "configuration"
},
{
"action": "Add UI Object",
"actionProject": "Visual-Scripting",
"disableIfPropertyIsDefined": true,
"propertyToCheckFor": "tradingBotsFollowing",
"actionFunction": "payload.executeAction",
"label": "Add Social Personas Following",
"relatedUiObject": "Social Personas Following",
"relatedUiObjectProject": "Governance"
},
{
"action": "Delete UI Object",
"actionProject": "Visual-Scripting",
"askConfirmation": true,
"confirmationLabel": "Confirm to Delete",
"label": "Delete",
"iconPathOn": "delete-entity",
"iconPathOff": "delete-entity",
"actionFunction": "payload.executeAction"
}
],
"editors": {
"config": true
},
"initialValues": {
"config": "{\"socialHandle\": \"\",\"bio\": \"\"}"
},
"addLeftIcons": true,
"level": 2,
"attachingRules": {
"compatibleTypes": "->Social Personas->"
},
"propertyNameAtParent": "socialPersonas",
"childrenNodesProperties": [
{
"name": "socialPersonasFollowing",
"type": "node",
"childType": "Social Personas Following",
"autoAdd": false
}
]
}
@@ -0,0 +1,50 @@
{
"type": "Social Personas Following",
"menuItems": [
{
"action": "Configure",
"actionFunction": "uiObject.configEditor.activate",
"label": "Configure",
"iconPathOn": "configuration",
"iconPathOff": "configuration"
},
{
"action": "Add UI Object",
"actionProject": "Visual-Scripting",
"actionFunction": "payload.executeAction",
"label": "Add Social Persona Followed",
"relatedUiObject": "Social Persona Followed",
"relatedUiObjectProject": "Governance"
},
{
"action": "Delete UI Object",
"actionProject": "Visual-Scripting",
"askConfirmation": true,
"confirmationLabel": "Confirm to Delete",
"label": "Delete",
"iconPathOn": "delete-entity",
"iconPathOff": "delete-entity",
"actionFunction": "payload.executeAction"
}
],
"editors": {
"config": true
},
"initialValues": {
"config": "{}"
},
"addLeftIcons": true,
"level": 2,
"attachingRules": {
"compatibleTypes": "->Social Persona->"
},
"propertyNameAtParent": "socialPersonasFollowing",
"childrenNodesProperties": [
{
"name": "socialPersonasFollowed",
"type": "array",
"childType": "Social Persona Followed",
"autoAdd": false
}
]
}
@@ -0,0 +1,50 @@
{
"type": "Social Personas",
"menuItems": [
{
"action": "Configure",
"actionFunction": "uiObject.configEditor.activate",
"label": "Configure",
"iconPathOn": "configuration",
"iconPathOff": "configuration"
},
{
"action": "Add UI Object",
"actionProject": "Visual-Scripting",
"actionFunction": "payload.executeAction",
"label": "Add Social Persona",
"relatedUiObject": "Social Persona",
"relatedUiObjectProject": "Governance"
},
{
"action": "Delete UI Object",
"actionProject": "Visual-Scripting",
"askConfirmation": true,
"confirmationLabel": "Confirm to Delete",
"label": "Delete",
"iconPathOn": "delete-entity",
"iconPathOff": "delete-entity",
"actionFunction": "payload.executeAction"
}
],
"editors": {
"config": true
},
"initialValues": {
"config": "{}"
},
"addLeftIcons": true,
"level": 2,
"attachingRules": {
"compatibleTypes": "->User Profile->"
},
"propertyNameAtParent": "userBots",
"childrenNodesProperties": [
{
"name": "socialPersonas",
"type": "array",
"childType": "Social Persona",
"autoAdd": false
}
]
}
@@ -0,0 +1,42 @@
{
"type": "Social Trading Bot Followed",
"menuItems": [
{
"action": "Configure",
"actionFunction": "uiObject.configEditor.activate",
"label": "Configure",
"iconPathOn": "configuration",
"iconPathOff": "configuration"
},
{
"action": "Delete UI Object",
"actionProject": "Visual-Scripting",
"askConfirmation": true,
"confirmationLabel": "Confirm to Delete",
"label": "Delete",
"iconPathOn": "delete-entity",
"iconPathOff": "delete-entity",
"actionFunction": "payload.executeAction"
}
],
"editors": {
"config": true
},
"initialValues": {
"config": "{}"
},
"addLeftIcons": true,
"level": 2,
"attachingRules": {
"compatibleTypes": "->Social Trading Bots Following->"
},
"referencingRules": {
"compatibleTypes": "->Social Trading Bot->"
},
"propertyNameAtParent": "socialTradingBotsFollowed",
"childrenNodesProperties": [
],
"title": [
"Use Reference Parent"
]
}
@@ -0,0 +1,52 @@
{
"type": "Social Trading Bot",
"menuItems": [
{
"action": "Configure",
"actionFunction": "uiObject.configEditor.activate",
"label": "Configure",
"iconPathOn": "configuration",
"iconPathOff": "configuration"
},
{
"action": "Add UI Object",
"actionProject": "Visual-Scripting",
"disableIfPropertyIsDefined": true,
"propertyToCheckFor": "socialTradingBotsFollowing",
"actionFunction": "payload.executeAction",
"label": "Add Social Trading Bots Following",
"relatedUiObject": "Social Trading Bots Following",
"relatedUiObjectProject": "Governance"
},
{
"action": "Delete UI Object",
"actionProject": "Visual-Scripting",
"askConfirmation": true,
"confirmationLabel": "Confirm to Delete",
"label": "Delete",
"iconPathOn": "delete-entity",
"iconPathOff": "delete-entity",
"actionFunction": "payload.executeAction"
}
],
"editors": {
"config": true
},
"initialValues": {
"config": "{}"
},
"addLeftIcons": true,
"level": 2,
"attachingRules": {
"compatibleTypes": "->Social Trading Bots->"
},
"propertyNameAtParent": "socialTradingBots",
"childrenNodesProperties": [
{
"name": "socialTradingBotsFollowing",
"type": "node",
"childType": "Social Trading Bots Following",
"autoAdd": false
}
]
}
@@ -0,0 +1,50 @@
{
"type": "Social Trading Bots Following",
"menuItems": [
{
"action": "Configure",
"actionFunction": "uiObject.configEditor.activate",
"label": "Configure",
"iconPathOn": "configuration",
"iconPathOff": "configuration"
},
{
"action": "Add UI Object",
"actionProject": "Visual-Scripting",
"actionFunction": "payload.executeAction",
"label": "Add Social Trading Bot Followed",
"relatedUiObject": "Social Trading Bot Followed",
"relatedUiObjectProject": "Governance"
},
{
"action": "Delete UI Object",
"actionProject": "Visual-Scripting",
"askConfirmation": true,
"confirmationLabel": "Confirm to Delete",
"label": "Delete",
"iconPathOn": "delete-entity",
"iconPathOff": "delete-entity",
"actionFunction": "payload.executeAction"
}
],
"editors": {
"config": true
},
"initialValues": {
"config": "{}"
},
"addLeftIcons": true,
"level": 2,
"attachingRules": {
"compatibleTypes": "->Social Trading Bot->"
},
"propertyNameAtParent": "socialTradingBotsFollowing",
"childrenNodesProperties": [
{
"name": "socialTradingBotsFollowed",
"type": "array",
"childType": "Social Trading Bot Followed",
"autoAdd": false
}
]
}
@@ -0,0 +1,50 @@
{
"type": "Social Trading Bots",
"menuItems": [
{
"action": "Configure",
"actionFunction": "uiObject.configEditor.activate",
"label": "Configure",
"iconPathOn": "configuration",
"iconPathOff": "configuration"
},
{
"action": "Add UI Object",
"actionProject": "Visual-Scripting",
"actionFunction": "payload.executeAction",
"label": "Add Social Trading Bot",
"relatedUiObject": "Social Trading Bot",
"relatedUiObjectProject": "Governance"
},
{
"action": "Delete UI Object",
"actionProject": "Visual-Scripting",
"askConfirmation": true,
"confirmationLabel": "Confirm to Delete",
"label": "Delete",
"iconPathOn": "delete-entity",
"iconPathOff": "delete-entity",
"actionFunction": "payload.executeAction"
}
],
"editors": {
"config": true
},
"initialValues": {
"config": "{}"
},
"addLeftIcons": true,
"level": 2,
"attachingRules": {
"compatibleTypes": "->User Bots->"
},
"propertyNameAtParent": "socialTradingBots",
"childrenNodesProperties": [
{
"name": "socialTradingBots",
"type": "array",
"childType": "Social Trading Bot",
"autoAdd": false
}
]
}
@@ -25,13 +25,13 @@
"config": true
},
"initialValues": {
"config": "{ \n\"codeName\": \"localhost\", \n\"host\": \"localhost\", \n\"webPort\": \"34248\", \n\"webSocketsPort\": \"17042\"\n}"
"config": "{ \n\"codeName\": \"localhost\", \n\"host\": \"localhost\", \n\"webPort\": \"33248\", \n\"webSocketsPort\": \"17042\"\n}"
},
"addLeftIcons": true,
"level": 1,
"attachingRules": {
"compatibleTypes": "->Signing Account->"
"compatibleTypes": "->Desktop Apps->"
},
"childrenNodesProperties": [],
"propertyNameAtParent": "signingAccountChild"
"propertyNameAtParent": "socialTradingDesktopApps"
}
@@ -30,8 +30,8 @@
"addLeftIcons": true,
"level": 1,
"attachingRules": {
"compatibleTypes": "->Signing Account->"
"compatibleTypes": "->Mobile Apps->"
},
"childrenNodesProperties": [],
"propertyNameAtParent": "signingAccountChild"
"propertyNameAtParent": "socialTradingMobileApps"
}
@@ -30,8 +30,8 @@
"addLeftIcons": true,
"level": 1,
"attachingRules": {
"compatibleTypes": "->Signing Account->"
"compatibleTypes": "->Server Apps->"
},
"childrenNodesProperties": [],
"propertyNameAtParent": "signingAccountChild"
"propertyNameAtParent": "socialTradingServerApps"
}
@@ -0,0 +1,84 @@
{
"type": "User Apps",
"menuItems": [
{
"action": "Configure",
"actionFunction": "uiObject.configEditor.activate",
"label": "Configure",
"iconPathOn": "configuration",
"iconPathOff": "configuration"
},
{
"action": "Add UI Object",
"actionProject": "Visual-Scripting",
"disableIfPropertyIsDefined": true,
"propertyToCheckFor": "desktopApps",
"actionFunction": "payload.executeAction",
"label": "Add Desktop Apps",
"relatedUiObject": "Desktop Apps",
"relatedUiObjectProject": "Governance"
},
{
"action": "Add UI Object",
"actionProject": "Visual-Scripting",
"disableIfPropertyIsDefined": true,
"propertyToCheckFor": "mobileApps",
"actionFunction": "payload.executeAction",
"label": "Add Mobile Apps",
"relatedUiObject": "Mobile Apps",
"relatedUiObjectProject": "Governance"
},
{
"action": "Add UI Object",
"actionProject": "Visual-Scripting",
"disableIfPropertyIsDefined": true,
"propertyToCheckFor": "serverApps",
"actionFunction": "payload.executeAction",
"label": "Add Server Apps",
"relatedUiObject": "Server Apps",
"relatedUiObjectProject": "Governance"
},
{
"action": "Delete UI Object",
"actionProject": "Visual-Scripting",
"askConfirmation": true,
"confirmationLabel": "Confirm to Delete",
"label": "Delete",
"iconPathOn": "delete-entity",
"iconPathOff": "delete-entity",
"actionFunction": "payload.executeAction"
}
],
"editors": {
"config": true
},
"initialValues": {
"config": "{}"
},
"addLeftIcons": true,
"level": 2,
"attachingRules": {
"compatibleTypes": "->User Profile->"
},
"propertyNameAtParent": "userApps",
"childrenNodesProperties": [
{
"name": "desktopApps",
"type": "node",
"childType": "Desktop Apps",
"autoAdd": false
},
{
"name": "mobileApps",
"type": "node",
"childType": "Mobile Apps",
"autoAdd": false
},
{
"name": "serverApps",
"type": "node",
"childType": "Server Apps",
"autoAdd": false
}
]
}
@@ -0,0 +1,52 @@
{
"type": "User Bots",
"menuItems": [
{
"action": "Configure",
"actionFunction": "uiObject.configEditor.activate",
"label": "Configure",
"iconPathOn": "configuration",
"iconPathOff": "configuration"
},
{
"action": "Add UI Object",
"actionProject": "Visual-Scripting",
"disableIfPropertyIsDefined": true,
"propertyToCheckFor": "socialTradingBots",
"actionFunction": "payload.executeAction",
"label": "Add Social Trading Bots",
"relatedUiObject": "Social Trading Bots",
"relatedUiObjectProject": "Governance"
},
{
"action": "Delete UI Object",
"actionProject": "Visual-Scripting",
"askConfirmation": true,
"confirmationLabel": "Confirm to Delete",
"label": "Delete",
"iconPathOn": "delete-entity",
"iconPathOff": "delete-entity",
"actionFunction": "payload.executeAction"
}
],
"editors": {
"config": true
},
"initialValues": {
"config": "{\"socialHandle\": \"\",\"bio\": \"\"}"
},
"addLeftIcons": true,
"level": 2,
"attachingRules": {
"compatibleTypes": "->User Profile->"
},
"propertyNameAtParent": "userBots",
"childrenNodesProperties": [
{
"name": "socialTradingBots",
"type": "node",
"childType": "Social Trading Bots",
"autoAdd": false
}
]
}
@@ -28,6 +28,46 @@
"relatedUiObject": "Tokens Mined",
"relatedUiObjectProject": "Governance"
},
{
"action": "Add UI Object",
"actionProject": "Visual-Scripting",
"disableIfPropertyIsDefined": true,
"propertyToCheckFor": "userApps",
"actionFunction": "payload.executeAction",
"label": "Add User Apps",
"relatedUiObject": "User Apps",
"relatedUiObjectProject": "Governance"
},
{
"action": "Add UI Object",
"actionProject": "Visual-Scripting",
"disableIfPropertyIsDefined": true,
"propertyToCheckFor": "userBots",
"actionFunction": "payload.executeAction",
"label": "Add User Bots",
"relatedUiObject": "User Bots",
"relatedUiObjectProject": "Governance"
},
{
"action": "Add UI Object",
"actionProject": "Visual-Scripting",
"disableIfPropertyIsDefined": true,
"propertyToCheckFor": "socialPersonas",
"actionFunction": "payload.executeAction",
"label": "Add Social Personas",
"relatedUiObject": "Social Personas",
"relatedUiObjectProject": "Governance"
},
{
"action": "Add UI Object",
"actionProject": "Visual-Scripting",
"disableIfPropertyIsDefined": true,
"propertyToCheckFor": "p2pNetworkNodes",
"actionFunction": "payload.executeAction",
"label": "Add P2P Network Nodes",
"relatedUiObject": "P2P Network Nodes",
"relatedUiObjectProject": "Governance"
},
{
"action": "Install as Plugin",
"actionProject": "Community-Plugins",
@@ -77,6 +117,30 @@
"type": "node",
"childType": "Signing Accounts",
"autoAdd": false
},
{
"name": "userApps",
"type": "node",
"childType": "User Apps",
"autoAdd": false
},
{
"name": "userBots",
"type": "node",
"childType": "User Bots",
"autoAdd": false
},
{
"name": "socialPersonas",
"type": "node",
"childType": "Social Personas",
"autoAdd": false
},
{
"name": "p2pNetworkNodes",
"type": "node",
"childType": "P2P Network Nodes",
"autoAdd": false
}
],
"inMapMode": {
@@ -38,29 +38,9 @@ function newGovernanceActionSwitch() {
UI.projects.governance.functionLibraries.profileConstructor.buildProfile(action.node, action.rootNodes)
break
}
case 'Add Social Trading Desktop App':
case 'Install Secrets':
{
UI.projects.governance.functionLibraries.profileConstructor.addSigningAccount(action.node, action.rootNodes, 'Social Trading Desktop App')
break
}
case 'Add Social Trading Server App':
{
UI.projects.governance.functionLibraries.profileConstructor.addSigningAccount(action.node, action.rootNodes, 'Social Trading Server App')
break
}
case 'Add Social Trading Mobile App':
{
UI.projects.governance.functionLibraries.profileConstructor.addSigningAccount(action.node, action.rootNodes, 'Social Trading Mobile App')
break
}
case 'Add Algo Traders Platform':
{
UI.projects.governance.functionLibraries.profileConstructor.addSigningAccount(action.node, action.rootNodes, 'Algo Traders Platform')
break
}
case 'Add P2P Network Node':
{
UI.projects.governance.functionLibraries.profileConstructor.addSigningAccount(action.node, action.rootNodes, 'P2P Network Node')
UI.projects.governance.functionLibraries.profileConstructor.installSecrets(action.node, action.rootNodes)
break
}
case 'Add Missing Plugin User Profiles':
@@ -69,9 +49,9 @@ function newGovernanceActionSwitch() {
}
break
case 'Add Specified User Profile':
{
UI.projects.governance.functionLibraries.pluginsFunctions.addSpecifiedUserProfile(action.node, action.rootNodes)
}
{
UI.projects.governance.functionLibraries.pluginsFunctions.addSpecifiedUserProfile(action.node, action.rootNodes)
}
break
case 'Add Missing Plugin Pools':
{
@@ -1,7 +1,7 @@
function newGovernanceFunctionLibraryProfileConstructor() {
let thisObject = {
buildProfile: buildProfile,
addSigningAccount: addSigningAccount
installSecrets: installSecrets
}
return thisObject
@@ -213,6 +213,10 @@ function newGovernanceFunctionLibraryProfileConstructor() {
*/
userProfile.payload.uiObject.menu.internalClick('Install as Plugin')
userProfile.payload.uiObject.menu.internalClick('Install as Plugin')
/*
Delete the mnemonic from the Profile Constructor config.
*/
node.config = "{}"
/*
TODO: Let's create a nice basic profile to start with liquidity and community
*/
@@ -236,25 +240,28 @@ function newGovernanceFunctionLibraryProfileConstructor() {
}
}
function addSigningAccount(
function installSecrets(
node,
rootNodes,
targetNodeType
rootNodes
) {
let githubUsername = UI.projects.visualScripting.utilities.nodeConfig.loadConfigProperty(node.payload, 'githubUsername')
let mnemonic = UI.projects.visualScripting.utilities.nodeConfig.loadConfigProperty(node.payload, 'mnemonic')
let signingAccounts
let secretsFile = {
secrets: []
}
let userProfile = node.payload.referenceParent
/*
Get Message to Sign.
*/
let userProfileHandle = UI.projects.visualScripting.utilities.nodeConfig.loadConfigProperty(userProfile.payload, 'codeName')
if (githubUsername === undefined || githubUsername === "") {
if (userProfileHandle === undefined || userProfileHandle === "") {
node.payload.uiObject.setErrorMessage(
"githubUsername config property missing.",
"User Profile codeName config property missing.",
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
)
return
}
/*
Some validations first...
Checking the reference to the User Profile...
*/
if (node.payload.referenceParent === undefined) {
node.payload.uiObject.setErrorMessage(
@@ -263,90 +270,59 @@ function newGovernanceFunctionLibraryProfileConstructor() {
)
return
}
/*
Delete Signing Accounts with all its children, it it exists.
*/
if (userProfile.signingAccounts !== undefined) {
let rootNodes = UI.projects.foundations.spaces.designSpace.workspace.workspaceNode.rootNodes
UI.projects.visualScripting.functionLibraries.nodeDeleter.deleteUIObject(userProfile.signingAccounts, rootNodes)
}
/*
Create Signing Accounts.
*/
let signingAccounts = UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.addUIObject(
userProfile,
'Signing Accounts',
UI.projects.foundations.spaces.designSpace.workspace.workspaceNode.rootNodes
)
if (node.payload.referenceParent.signingAccounts === undefined) {
signingAccounts = UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.addUIObject(
node.payload.referenceParent,
'Signing Accounts',
UI.projects.foundations.spaces.designSpace.workspace.workspaceNode.rootNodes
)
} else {
signingAccounts = node.payload.referenceParent.signingAccounts
let algoTradersPlatform = UI.projects.visualScripting.utilities.branches.nodeBranchToArray(userProfile.userApps, 'Algo Traders Platform')
let socialTradingDesktopApp = UI.projects.visualScripting.utilities.branches.nodeBranchToArray(userProfile.userApps, 'Social Trading Desktop App')
let socialTradingMobileApp = UI.projects.visualScripting.utilities.branches.nodeBranchToArray(userProfile.userApps, 'Social Trading Mobile App')
let socialTradingServerApp = UI.projects.visualScripting.utilities.branches.nodeBranchToArray(userProfile.userApps, 'Social Trading Server App')
let socialTradingBots = UI.projects.visualScripting.utilities.branches.nodeBranchToArray(userProfile.userBots, 'Social Trading Bot')
let socialPersonas = UI.projects.visualScripting.utilities.branches.nodeBranchToArray(userProfile.socialPersonas, 'Social Persona')
let p2pNetworkNodes = UI.projects.visualScripting.utilities.branches.nodeBranchToArray(userProfile.p2pNetworkNodes, 'P2P Network Node')
addSigningAccounts(algoTradersPlatform, 'Algo Traders Platform')
addSigningAccounts(socialTradingDesktopApp, 'Social Trading Desktop App')
addSigningAccounts(socialTradingMobileApp, 'Social Trading Mobile App')
addSigningAccounts(socialTradingServerApp, 'Social Trading Server App')
addSigningAccounts(socialTradingBots, 'Social Trading Bot')
addSigningAccounts(socialPersonas, 'Social Persona')
addSigningAccounts(p2pNetworkNodes, 'P2P Network Node')
function addSigningAccounts(nodeArray, targetNodeType) {
for (let i = 0; i < nodeArray.length; i++) {
let currentNode = nodeArray[i]
addSigningAccount(currentNode, targetNodeType, i + 1)
}
}
createWallet()
function createWallet() {
let params
/*
If the user provides a mnemonic then we will get the private key and address from it,
otherwise, we will create a new private key and address.
*/
if (mnemonic === undefined || mnemonic === "") {
params = {
method: 'createWalletAccount',
entropy: node.id + (new Date()).valueOf()
}
} else {
params = {
method: 'mnemonicToPrivateKey',
mnemonic: mnemonic
}
function addSigningAccount(
targetNode,
targetNodeType,
targetNodeTypeCount
) {
let params = {
method: 'createWalletAccount',
entropy: node.id + (new Date()).valueOf()
}
let url = 'WEB3' // We will access the default Client WEB3 endpoint.
httpRequest(JSON.stringify(params), url, onResponse)
function onResponse(err, data) {
/* Lets check the result of the call through the http interface */
if (err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
node.payload.uiObject.setErrorMessage(
'Call via HTTP Interface failed.',
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
)
return
}
let response = JSON.parse(data)
/* Lets check the result of the method call */
if (response.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
if (mnemonic === undefined || mnemonic === "") {
node.payload.uiObject.setErrorMessage(
'Call to WEB3 Server failed. ' + response.error,
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
)
console.log('Call to WEB3 Server failed. ' + response.error)
return
} else {
node.payload.uiObject.setErrorMessage(
'Call to WEB3 Server failed. Most likely the Mnemonic provided is not correct or you need to run node setup because a dependency is missing. ' + response.error,
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
)
console.log('Call to WEB3 Server failed. Most likely the Mnemonic provided is not correct or you need to run node setup because a dependency is missing. ' + response.error)
return
}
}
signUserProfileData(response.address, response.privateKey)
}
}
function signUserProfileData(address, privateKey) {
let request = {
url: 'WEB3',
params: {
method: "signData",
privateKey: privateKey,
data: githubUsername
}
}
httpRequest(JSON.stringify(request.params), request.url, onResponse)
function onResponse(err, data) {
/* Lets check the result of the call through the http interface */
if (err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
@@ -368,73 +344,106 @@ function newGovernanceFunctionLibraryProfileConstructor() {
console.log('Call to WEB3 Server failed. ' + response.error)
return
}
createSigningAccount(response.signature)
signSigningAccountData(response.privateKey)
}
function createSigningAccount(signature) {
function signSigningAccountData(privateKey) {
let signingAccount = UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.addUIObject(
signingAccounts,
'Signing Account',
UI.projects.foundations.spaces.designSpace.workspace.workspaceNode.rootNodes
)
let signingAccountChild = UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.addUIObject(
signingAccount,
targetNodeType,
UI.projects.foundations.spaces.designSpace.workspace.workspaceNode.rootNodes
)
/*
Let's get a cool name for this node.
*/
let targetNodeTypeCount = 0
for (let i = 0; i < signingAccounts.signingAccounts.length; i++) {
let singningAccount = signingAccounts.signingAccounts[i]
if (singningAccount.signingAccountChild.type === targetNodeType) {
targetNodeTypeCount++
let request = {
url: 'WEB3',
params: {
method: "signData",
privateKey: privateKey,
data: userProfileHandle
}
}
signingAccountChild.name = targetNodeType +" # " + targetNodeTypeCount
let codeName = targetNodeType.replaceAll(' ', '-') + "-" + targetNodeTypeCount
/*
We store at the User Profile the Signed githubUsername
*/
UI.projects.visualScripting.utilities.nodeConfig.saveConfigProperty(signingAccountChild.payload, 'codeName', codeName)
UI.projects.visualScripting.utilities.nodeConfig.saveConfigProperty(signingAccount.payload, 'signature', signature)
let secrets = UI.projects.visualScripting.utilities.nodeConfig.loadConfigProperty(node.payload, 'secrets', signingAccount.name)
if (secrets === undefined) {
secrets = []
httpRequest(JSON.stringify(request.params), request.url, onResponse)
function onResponse(err, data) {
/* Lets check the result of the call through the http interface */
if (err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
node.payload.uiObject.setErrorMessage(
'Call via HTTP Interface failed.',
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
)
return
}
let response = JSON.parse(data)
/* Lets check the result of the method call */
if (response.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
node.payload.uiObject.setErrorMessage(
'Call to WEB3 Server failed. ' + response.error,
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
)
console.log('Call to WEB3 Server failed. ' + response.error)
return
}
createSigningAccount(response.signature)
}
let secret = {
signingAccountChildId: signingAccountChild.id,
signingAccountChildName: signingAccountChild.name,
signingAccountChildType: targetNodeType,
signingAccountChildCodeName: codeName,
signingAccountNodeId: signingAccount.id,
privateKey: privateKey,
userProfileHandle: githubUsername,
userProfileId: node.payload.referenceParent.id
}
function createSigningAccount(signature) {
secrets.push(secret)
UI.projects.visualScripting.utilities.nodeConfig.saveConfigProperty(node.payload, 'secrets', secrets)
/*
Show nice message.
*/
if (mnemonic === undefined || mnemonic === "") {
node.payload.uiObject.setInfoMessage(
"Signing Account has been successfully created.",
UI.projects.governance.globals.designer.SET_INFO_COUNTER_FACTOR
)
} else {
node.payload.uiObject.setInfoMessage(
"Mnemonic successfully imported. Signing Account has been successfully created.",
UI.projects.governance.globals.designer.SET_INFO_COUNTER_FACTOR
let signingAccount = UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.addUIObject(
signingAccounts,
'Signing Account',
UI.projects.foundations.spaces.designSpace.workspace.workspaceNode.rootNodes
)
signingAccount.payload.floatingObject.angleToParent = ANGLE_TO_PARENT.RANGE_180
UI.projects.visualScripting.functionLibraries.attachDetach.referenceAttachNode(signingAccount, targetNode)
/*
Let's get a cool name for this node.
*/
targetNode.name = targetNodeType + " #" + targetNodeTypeCount
let codeName = targetNodeType.replaceAll(' ', '-') + "-" + targetNodeTypeCount
/*
We store at the User Profile the Signed userProfileHandle
*/
UI.projects.visualScripting.utilities.nodeConfig.saveConfigProperty(targetNode.payload, 'codeName', codeName)
UI.projects.visualScripting.utilities.nodeConfig.saveConfigProperty(signingAccount.payload, 'codeName', codeName)
UI.projects.visualScripting.utilities.nodeConfig.saveConfigProperty(signingAccount.payload, 'signature', signature)
let secrets = secretsFile.secrets
let secret = {
nodeId: targetNode.id,
nodeName: targetNode.name,
nodeType: targetNodeType,
nodeCodeName: codeName,
signingAccountNodeId: signingAccount.id,
privateKey: privateKey,
userProfileHandle: userProfileHandle,
userProfileId: userProfile.id
}
secrets.push(secret)
/*
Save Secrets File
*/
httpRequest(JSON.stringify(secretsFile, undefined, 4), 'Secrets/Save-Secrets-File', onResponse)
function onResponse(err, data) {
/* Lets check the result of the call through the http interface */
data = JSON.parse(data)
if (err.result != GLOBAL.DEFAULT_OK_RESPONSE.result || data.result != GLOBAL.DEFAULT_OK_RESPONSE.result) {
node.payload.uiObject.setErrorMessage(
"Secrets file could not be created.",
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
)
} else {
/*
Show nice message.
*/
node.payload.uiObject.setInfoMessage(
"Secrets file have been sucessfully created.",
UI.projects.governance.globals.designer.SET_INFO_COUNTER_FACTOR
)
}
}
}
}
}
@@ -111,7 +111,7 @@ exports.newMachineLearningBotModulesLearningEngine = function (processIndex) {
destinationNode.value = originNode.value
/* Now we go down through all the children of the origin node, assuming the destination node has the same children structure*/
let schemaDocument = TS.projects.foundations.globals.taskConstants.APP_SCHEMA_MAP.get(originNode.project + '-' + originNode.type)
let schemaDocument = SA.projects.foundations.globals.schemas.APP_SCHEMA_MAP.get(originNode.project + '-' + originNode.type)
if (schemaDocument === undefined) { return }
if (schemaDocument.childrenNodesProperties !== undefined) {
@@ -150,7 +150,7 @@ exports.newMachineLearningBotModulesLearningEngine = function (processIndex) {
nodesMap.set(node.id, node)
/* Now we go down through all this node children */
let schemaDocument = TS.projects.foundations.globals.taskConstants.APP_SCHEMA_MAP.get(node.project + '-' + node.type)
let schemaDocument = SA.projects.foundations.globals.schemas.APP_SCHEMA_MAP.get(node.project + '-' + node.type)
if (schemaDocument === undefined) { return }
if (schemaDocument.childrenNodesProperties !== undefined) {
@@ -193,7 +193,7 @@ exports.newMachineLearningBotModulesLearningEngine = function (processIndex) {
}
/* Now we go down through all this node children */
let schemaDocument = TS.projects.foundations.globals.taskConstants.APP_SCHEMA_MAP.get(node.project + '-' + node.type)
let schemaDocument = SA.projects.foundations.globals.schemas.APP_SCHEMA_MAP.get(node.project + '-' + node.type)
if (schemaDocument === undefined) { return }
if (schemaDocument.childrenNodesProperties !== undefined) {
@@ -31,7 +31,7 @@ exports.newMachineLearningBotModulesLearningOutput = function (processIndex) {
/* Preparing everything for the Simulation */
let learningSimulationModuleObject = TS.projects.machineLearning.botModules.learningSimulation.newMachineLearningBotModulesLearningSimulation(processIndex)
let outputDatasets = TS.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processOutput, 'Output Dataset')
let outputDatasets = SA.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processOutput, 'Output Dataset')
let outputDatasetsMap = new Map()
await TS.projects.foundations.functionLibraries.outputManagementFunctions.readFiles(
@@ -37,7 +37,7 @@ exports.newMachineLearningBotModulesLearningRecords = function (processIndex) {
we have a pointer to the node that have the information we need to extract.
Later, based on the product record definition we will extract each individual value.
*/
let outputDatasets = TS.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processOutput, 'Output Dataset')
let outputDatasets = SA.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processOutput, 'Output Dataset')
for (let i = 0; i < outputDatasets.length; i++) {
let outputDatasetNode = outputDatasets[i]
@@ -381,8 +381,8 @@ exports.newMachineLearningBotModulesLearningSimulation = function (processIndex)
}
function positionChart(chart) {
let dataDependencies = TS.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processDependencies, 'Data Dependency')
dataDependencies = TS.projects.visualScripting.utilities.nodeFunctions.filterOutNodeWihtoutReferenceParentFromNodeArray(dataDependencies)
let dataDependencies = SA.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(TS.projects.foundations.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processDependencies, 'Data Dependency')
dataDependencies = SA.projects.visualScripting.utilities.nodeFunctions.filterOutNodeWihtoutReferenceParentFromNodeArray(dataDependencies)
/* Finding the Current Element on Market Files */
if (TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).TRADING_PROCESSING_DAILY_FILES) {
@@ -292,7 +292,7 @@ exports.newMachineLearningBotModulesLearningSystem = function (processIndex) {
}
/* Now we go down through all this node children */
let schemaDocument = TS.projects.foundations.globals.taskConstants.APP_SCHEMA_MAP.get(node.project + '-' + node.type)
let schemaDocument = SA.projects.foundations.globals.schemas.APP_SCHEMA_MAP.get(node.project + '-' + node.type)
if (schemaDocument === undefined) { return }
if (schemaDocument.childrenNodesProperties !== undefined) {
+1 -1
View File
@@ -31,7 +31,7 @@ exports.newNetworkModulesP2PNetwork = function newNetworkModulesP2PNetwork() {
case 'Network Peer': {
thisObject.p2pNodesToConnect = []
let thisP2PNodeId = SA.secrets.map.get(global.env.P2P_NETWORK_NODE_SIGNING_ACCOUNT).signingAccountChildId
let thisP2PNodeId = SA.secrets.map.get(global.env.P2P_NETWORK_NODE_SIGNING_ACCOUNT).nodeId
for (let i = 0; i < SA.projects.network.globals.memory.arrays.P2P_NETWORK_NODES.length; i++) {
let p2pNetworkNode = SA.projects.network.globals.memory.arrays.P2P_NETWORK_NODES[i]
if (thisP2PNodeId !== p2pNetworkNode.node.id) {
+147 -72
View File
@@ -18,88 +18,163 @@ exports.newNetworkModulesUserProfiles = function newNetworkModulesUserProfiles()
}
async function initialize(signingAccountChildCodeName, p2pNetworkIdentity) {
async function initialize(nodeCodeName, p2pNetworkIdentity) {
let pluginFileNames = await SA.projects.communityPlugins.utilities.plugins.getPluginFileNames(
'Governance',
'User-Profiles'
)
await loadAppSchemas()
await loadProfiles()
for (let i = 0; i < pluginFileNames.length; i++) {
let pluginFileName = pluginFileNames[i]
async function loadAppSchemas() {
let pluginFileContent = await SA.projects.communityPlugins.utilities.plugins.getPluginFileContent(
'Governance',
'User-Profiles',
pluginFileName
)
let promise = new Promise((resolve, reject) => {
let userProfilePlugin = JSON.parse(pluginFileContent)
let config = JSON.parse(userProfilePlugin.config)
let signatureObject = config.signature
let web3 = new SA.nodeModules.web3()
let blockchainAccount = web3.eth.accounts.recover(signatureObject)
let ranking = 0 // TODO: read the blockchain balance and transactions from the Treasury Account to calculate the profile ranking.
let userProfileId = userProfilePlugin.id
let userHandle = config.signature.message
let project = 'Governance'
let filePath = global.env.PATH_TO_PROJECTS + '/' + project + '/Schemas/'
let folder = 'App-Schema'
let userProfile = SA.projects.socialTrading.modules.socialGraphUserProfile.newSocialTradingModulesSocialGraphUserProfile()
userProfile.initialize(
userProfileId,
userHandle,
blockchainAccount,
ranking
)
SA.projects.foundations.utilities.filesAndDirectories.getAllFilesInDirectoryAndSubdirectories(filePath + folder, onFilesReady)
SA.projects.network.globals.memory.maps.USER_PROFILES_BY_ID.set(userProfileId, userProfile)
SA.projects.network.globals.memory.maps.USER_PROFILES_BY_HANDLE.set(userHandle, userProfile)
SA.projects.network.globals.memory.maps.USER_PROFILES_BY_BLOKCHAIN_ACCOUNT.set(blockchainAccount, userProfile)
/*
Each User Profile might have Signing Accounts, meaning
accounts that can be signed on behalf of the User Profile.
*/
if (userProfilePlugin.signingAccounts !== undefined) {
for (let j = 0; j < userProfilePlugin.signingAccounts.signingAccounts.length; j++) {
let signingAccount = userProfilePlugin.signingAccounts.signingAccounts[j]
let config = JSON.parse(signingAccount.config)
let signatureObject = config.signature
let web3 = new SA.nodeModules.web3()
let blockchainAccount = web3.eth.accounts.recover(signatureObject)
SA.projects.network.globals.memory.maps.USER_PROFILES_BY_BLOKCHAIN_ACCOUNT.set(blockchainAccount, userProfile)
/*
If the Signing Account is for a P2P node, we will add the node to the array of available nodes at the p2p network.
*/
if (
signingAccount.signingAccountChild.type === "P2P Network Node" &&
signingAccount.signingAccountChild.config !== undefined
) {
let config
function onFilesReady(files) {
for (let k = 0; k < files.length; k++) {
let name = files[k]
let nameSplitted = name.split(folder)
let fileName = nameSplitted[1]
for (let i = 0; i < 10; i++) {
fileName = fileName.replace('\\', '/')
}
let fileToRead = filePath + folder + fileName
let fileContent = SA.nodeModules.fs.readFileSync(fileToRead)
let schemaDocument
try {
config = JSON.parse(signingAccount.signingAccountChild.config)
schemaDocument = JSON.parse(fileContent)
SA.projects.foundations.globals.schemas.APP_SCHEMA_MAP.set(project + '-' + schemaDocument.type, schemaDocument)
} catch (err) {
console.log('P2P Network Node Config not in JSON format. userProfileHandle = ' + userHandle + ' NodeId = ' + signingAccount.signingAccountChild.id)
continue
console.log('[WARN] loadAppSchemas -> Error Parsing JSON File: ' + fileToRead + '. Error = ' + err.stack)
return
}
if (config.host === undefined) {
continue
}
if (config.webSocketsPort === undefined) {
continue
}
let p2pNetworkNode = SA.projects.network.modules.p2pNetworkNode.newNetworkModulesP2PNetworkNode()
p2pNetworkNode.initialize(signingAccount.signingAccountChild, userProfile, blockchainAccount)
SA.projects.network.globals.memory.arrays.P2P_NETWORK_NODES.push(p2pNetworkNode)
}
/*
Now, we will extract the information from the User Profile, specifically of our identity at the p2p network.
*/
if (
signingAccount.signingAccountChild.id === SA.secrets.map.get(signingAccountChildCodeName).signingAccountChildId
) {
p2pNetworkIdentity.node = signingAccount.signingAccountChild
p2pNetworkIdentity.blockchainAccount = blockchainAccount
p2pNetworkIdentity.userProfile = userProfile
resolve()
}
}
)
return promise
}
async function loadProfiles() {
let pluginFileNames = await SA.projects.communityPlugins.utilities.plugins.getPluginFileNames(
'Governance',
'User-Profiles'
)
for (let i = 0; i < pluginFileNames.length; i++) {
let pluginFileName = pluginFileNames[i]
let pluginFileContent = await SA.projects.communityPlugins.utilities.plugins.getPluginFileContent(
'Governance',
'User-Profiles',
pluginFileName
)
let userProfilePlugin = JSON.parse(pluginFileContent)
let config = JSON.parse(userProfilePlugin.config)
let signatureObject = config.signature
let web3 = new SA.nodeModules.web3()
let blockchainAccount = web3.eth.accounts.recover(signatureObject)
let ranking = 0 // TODO: read the blockchain balance and transactions from the Treasury Account to calculate the profile ranking.
let userProfileId = userProfilePlugin.id
let userHandle = config.signature.message
let userProfile = SA.projects.socialTrading.modules.socialGraphUserProfile.newSocialTradingModulesSocialGraphUserProfile()
userProfile.initialize(
userProfileId,
userHandle,
blockchainAccount,
ranking
)
SA.projects.network.globals.memory.maps.USER_PROFILES_BY_ID.set(userProfileId, userProfile)
SA.projects.network.globals.memory.maps.USER_PROFILES_BY_HANDLE.set(userHandle, userProfile)
SA.projects.network.globals.memory.maps.USER_PROFILES_BY_BLOKCHAIN_ACCOUNT.set(blockchainAccount, userProfile)
/*
Each User Profile might have Signing Accounts, meaning
accounts that can sign on behalf of the User Profile.
*/
if (userProfilePlugin.signingAccounts !== undefined) {
let algoTradersPlatform = SA.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(userProfilePlugin.userApps, 'Algo Traders Platform')
let socialTradingDesktopApp = SA.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(userProfilePlugin.userApps, 'Social Trading Desktop App')
let socialTradingMobileApp = SA.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(userProfilePlugin.userApps, 'Social Trading Mobile App')
let socialTradingServerApp = SA.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(userProfilePlugin.userApps, 'Social Trading Server App')
let socialTradingBots = SA.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(userProfilePlugin.userBots, 'Social Trading Bot')
let socialPersonas = SA.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(userProfilePlugin.socialPersonas, 'Social Persona')
let p2pNetworkNodes = SA.projects.visualScripting.utilities.nodeFunctions.nodeBranchToArray(userProfilePlugin.p2pNetworkNodes, 'P2P Network Node')
let networkClientsMap = new Map()
addToNetworkClientMap(algoTradersPlatform)
addToNetworkClientMap(socialTradingDesktopApp)
addToNetworkClientMap(socialTradingMobileApp)
addToNetworkClientMap(socialTradingServerApp)
addToNetworkClientMap(socialTradingBots)
addToNetworkClientMap(socialPersonas)
addToNetworkClientMap(p2pNetworkNodes)
function addToNetworkClientMap(nodeArray) {
for (let i = 0; i < nodeArray.length; i++) {
let currentNode = nodeArray[i]
networkClientsMap.set(currentNode.id, currentNode)
}
}
for (let j = 0; j < userProfilePlugin.signingAccounts.signingAccounts.length; j++) {
let signingAccount = userProfilePlugin.signingAccounts.signingAccounts[j]
let config = JSON.parse(signingAccount.config)
let signatureObject = config.signature
let web3 = new SA.nodeModules.web3()
let blockchainAccount = web3.eth.accounts.recover(signatureObject)
SA.projects.network.globals.memory.maps.USER_PROFILES_BY_BLOKCHAIN_ACCOUNT.set(blockchainAccount, userProfile)
/*
If the Signing Account is for a P2P node, we will add the node to the array of available nodes at the p2p network.
*/
if (signingAccount.savedPayload === undefined) { continue }
if (signingAccount.savedPayload.referenceParent === undefined) { continue }
signingAccount.referenceParent = networkClientsMap.get(signingAccount.savedPayload.referenceParent.id)
if (
signingAccount.referenceParent !== undefined &&
signingAccount.referenceParent.type === "P2P Network Node" &&
signingAccount.referenceParent.config !== undefined
) {
let config
try {
config = JSON.parse(signingAccount.referenceParent.config)
} catch (err) {
console.log('P2P Network Node Config not in JSON format. userProfileHandle = ' + userHandle + ' NodeId = ' + signingAccount.referenceParent.id)
continue
}
if (config.host === undefined) {
continue
}
if (config.webSocketsPort === undefined) {
continue
}
let p2pNetworkNode = SA.projects.network.modules.p2pNetworkNode.newNetworkModulesP2PNetworkNode()
p2pNetworkNode.initialize(signingAccount.referenceParent, userProfile, blockchainAccount)
SA.projects.network.globals.memory.arrays.P2P_NETWORK_NODES.push(p2pNetworkNode)
}
/*
Now, we will extract the information from the User Profile, specifically of our identity at the p2p network.
*/
if (
signingAccount.referenceParent !== undefined &&
signingAccount.referenceParent.id === SA.secrets.map.get(nodeCodeName).nodeId
) {
p2pNetworkIdentity.node = signingAccount.referenceParent
p2pNetworkIdentity.blockchainAccount = blockchainAccount
p2pNetworkIdentity.userProfile = userProfile
}
}
}
}
+7 -1
View File
@@ -329,7 +329,7 @@
}
]
},
"TS": {
"SA": {
"utilities": [
{
"name": "Node Functions",
@@ -795,6 +795,12 @@
"propertyName": "timeConstants",
"functionName": "newFoundationsGlobalsTimeConstants",
"fileName": "TimeConstants.js"
},
{
"name": "Schemas",
"propertyName": "schemas",
"functionName": "newFoundationsGlobalsSchemas",
"fileName": "Schemas.js"
}
],
"utilities": [
@@ -12,11 +12,15 @@ exports.newVisualScriptingUtilitiesNodeFunctions = function () {
function nodeBranchToArray(node, nodeType) {
let resultArray = []
scanNodeBranch(node, nodeType)
scanNodeBranch(node)
return resultArray
function scanNodeBranch(startingNode) {
let schemaDocument = TS.projects.foundations.globals.taskConstants.APP_SCHEMA_MAP.get(startingNode.project + '-' + startingNode.type)
if (startingNode === undefined) {
return
}
let schemaDocument = SA.projects.foundations.globals.schemas.APP_SCHEMA_MAP.get(startingNode.project + '-' + startingNode.type)
if (schemaDocument === undefined) { return }
if (startingNode.type === nodeType) {
@@ -53,14 +57,14 @@ exports.newVisualScriptingUtilitiesNodeFunctions = function () {
returns the first instance found.
*/
let nodeFound
scanNodeMesh(node, nodeType)
scanNodeMesh(node)
return nodeFound
function scanNodeMesh(startingNode) {
if (startingNode === undefined) { return }
if (nodeFound !== undefined) { return }
let schemaDocument = TS.projects.foundations.globals.taskConstants.APP_SCHEMA_MAP.get(startingNode.project + '-' + startingNode.type)
let schemaDocument = SA.projects.foundations.globals.schemas.APP_SCHEMA_MAP.get(startingNode.project + '-' + startingNode.type)
if (schemaDocument === undefined) { return }
if (startingNode.type === nodeType) {
@@ -114,7 +118,7 @@ exports.newVisualScriptingUtilitiesNodeFunctions = function () {
function scanNodeMesh(startingNode) {
if (startingNode === undefined) { return }
let schemaDocument = TS.projects.foundations.globals.taskConstants.APP_SCHEMA_MAP.get(startingNode.project + '-' + startingNode.type)
let schemaDocument = SA.projects.foundations.globals.schemas.APP_SCHEMA_MAP.get(startingNode.project + '-' + startingNode.type)
if (schemaDocument === undefined) { return }
if (startingNode.id === nodeId) {
+2 -2
View File
@@ -76,7 +76,7 @@ exports.newTaskServer = function newTaskServer() {
for (let j = 0; j < project.schema.length; j++) {
let schemaDocument = project.schema[j]
let key = project.name + '-' + schemaDocument.type
TS.projects.foundations.globals.taskConstants.APP_SCHEMA_MAP.set(key, schemaDocument)
SA.projects.foundations.globals.schemas.APP_SCHEMA_MAP.set(key, schemaDocument)
}
}
}
@@ -88,7 +88,7 @@ exports.newTaskServer = function newTaskServer() {
setupTaskHeartbeats()
function initializeProjectDefinitionNode() {
TS.projects.foundations.globals.taskConstants.PROJECT_DEFINITION_NODE = TS.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(TS.projects.foundations.globals.taskConstants.TASK_NODE, 'Project Definition')
TS.projects.foundations.globals.taskConstants.PROJECT_DEFINITION_NODE = SA.projects.visualScripting.utilities.nodeFunctions.findNodeInNodeMesh(TS.projects.foundations.globals.taskConstants.TASK_NODE, 'Project Definition')
if (TS.projects.foundations.globals.taskConstants.PROJECT_DEFINITION_NODE === undefined) {
console.log("[ERROR] Task Server -> Task -> bootingProcess -> Project Definition not found. ")
TS.projects.foundations.globals.taskVariables.FATAL_ERROR_MESSAGE = 'Project Definition not found. Fatal Error, can not continue. Fix the problem and try again.'