Merge pull request #2734 from Luis-Fernando-Molina/develop
Contribution: Signing Accounts moved to be child of each Network Client
This commit is contained in:
18 files changed
+530
-772
No files matched your search
@@ -9,6 +9,16 @@
|
||||
"actionProject": "Visual-Scripting",
|
||||
"relatedUiObjectProject": "Foundations"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
"propertyToCheckFor": "socialTradingBotReference",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"label": "Add Social Trading Bot Reference",
|
||||
"relatedUiObject": "Social Trading Bot Reference",
|
||||
"relatedUiObjectProject": "Governance"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
@@ -31,6 +41,12 @@
|
||||
"type": "array",
|
||||
"childType": "Trading Process Instance",
|
||||
"autoAdd": false
|
||||
},
|
||||
{
|
||||
"name": "socialTradingBotReference",
|
||||
"type": "node",
|
||||
"childType": "Social Trading Bot Reference",
|
||||
"autoAdd": false
|
||||
}
|
||||
],
|
||||
"propertyNameAtParent": "bot"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Delete",
|
||||
"label": "Delete",
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
File diff suppressed because it is too large.
Load diff
@@ -32,6 +32,13 @@
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Desktop Apps->"
|
||||
},
|
||||
"childrenNodesProperties": [],
|
||||
"childrenNodesProperties": [
|
||||
{
|
||||
"name": "signingAccount",
|
||||
"type": "node",
|
||||
"childType": "Signing Account",
|
||||
"autoAdd": false
|
||||
}
|
||||
],
|
||||
"propertyNameAtParent": "algoTradesPlatform"
|
||||
}
|
||||
@@ -32,6 +32,13 @@
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->P2P Network Nodes->"
|
||||
},
|
||||
"childrenNodesProperties": [],
|
||||
"childrenNodesProperties": [
|
||||
{
|
||||
"name": "signingAccount",
|
||||
"type": "node",
|
||||
"childType": "Signing Account",
|
||||
"autoAdd": false
|
||||
}
|
||||
],
|
||||
"propertyNameAtParent": "p2pNetworkNodes"
|
||||
}
|
||||
@@ -20,9 +20,9 @@
|
||||
"relatedUiObjectProject": "Governance"
|
||||
},
|
||||
{
|
||||
"action": "Install Secrets",
|
||||
"action": "Install Signing Accounts",
|
||||
"actionProject": "Governance",
|
||||
"label": "Install Secrets",
|
||||
"label": "Install Signing Accounts",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Proceed",
|
||||
"workDoneLabel": "Done",
|
||||
|
||||
@@ -23,10 +23,7 @@
|
||||
"addLeftIcons": true,
|
||||
"level": 2,
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Signing Accounts->"
|
||||
},
|
||||
"referencingRules": {
|
||||
"compatibleTypes": "->P2P Network Node->Algo Traders Platform->Social Trading Mobile App->Social Trading Desktop App->Social Trading Server App->"
|
||||
"compatibleTypes": "->P2P Network Node->Algo Traders Platform->Social Trading Mobile App->Social Trading Desktop App->Social Trading Server App->Social Trading Bot->Social Persona->"
|
||||
},
|
||||
"editors": {
|
||||
"config": true
|
||||
@@ -35,8 +32,5 @@
|
||||
"config": "{}"
|
||||
},
|
||||
"propertyNameAtParent": "signingAccounts",
|
||||
"childrenNodesProperties": [],
|
||||
"title": [
|
||||
"Use Reference Parent"
|
||||
]
|
||||
"childrenNodesProperties": []
|
||||
}
|
||||
@@ -47,6 +47,12 @@
|
||||
"type": "node",
|
||||
"childType": "Social Personas Following",
|
||||
"autoAdd": false
|
||||
},
|
||||
{
|
||||
"name": "signingAccount",
|
||||
"type": "node",
|
||||
"childType": "Signing Account",
|
||||
"autoAdd": false
|
||||
}
|
||||
]
|
||||
}
|
||||
+9
-11
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"type": "Signing Accounts",
|
||||
"type": "Social Trading Bot Reference",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
@@ -12,18 +12,16 @@
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"title": [
|
||||
"Use Reference Parent"
|
||||
],
|
||||
"addLeftIcons": true,
|
||||
"level": 2,
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->User Profile->"
|
||||
"compatibleTypes": "->Trading Bot Instance->"
|
||||
},
|
||||
"propertyNameAtParent": "signingAccounts",
|
||||
"childrenNodesProperties": [
|
||||
{
|
||||
"name": "signingAccounts",
|
||||
"type": "array",
|
||||
"childType": "Signing Account",
|
||||
"autoAdd": false
|
||||
}
|
||||
]
|
||||
"referencingRules": {
|
||||
"compatibleTypes": "->Social Trading Bot->"
|
||||
},
|
||||
"propertyNameAtParent": "socialTradingBotReference"
|
||||
}
|
||||
@@ -47,6 +47,12 @@
|
||||
"type": "node",
|
||||
"childType": "Social Trading Bots Following",
|
||||
"autoAdd": false
|
||||
},
|
||||
{
|
||||
"name": "signingAccount",
|
||||
"type": "node",
|
||||
"childType": "Signing Account",
|
||||
"autoAdd": false
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -32,6 +32,13 @@
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Desktop Apps->"
|
||||
},
|
||||
"childrenNodesProperties": [],
|
||||
"childrenNodesProperties": [
|
||||
{
|
||||
"name": "signingAccount",
|
||||
"type": "node",
|
||||
"childType": "Signing Account",
|
||||
"autoAdd": false
|
||||
}
|
||||
],
|
||||
"propertyNameAtParent": "socialTradingDesktopApps"
|
||||
}
|
||||
@@ -32,6 +32,13 @@
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Mobile Apps->"
|
||||
},
|
||||
"childrenNodesProperties": [],
|
||||
"childrenNodesProperties": [
|
||||
{
|
||||
"name": "signingAccount",
|
||||
"type": "node",
|
||||
"childType": "Signing Account",
|
||||
"autoAdd": false
|
||||
}
|
||||
],
|
||||
"propertyNameAtParent": "socialTradingMobileApps"
|
||||
}
|
||||
@@ -32,6 +32,13 @@
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Server Apps->"
|
||||
},
|
||||
"childrenNodesProperties": [],
|
||||
"childrenNodesProperties": [
|
||||
{
|
||||
"name": "signingAccount",
|
||||
"type": "node",
|
||||
"childType": "Signing Account",
|
||||
"autoAdd": false
|
||||
}
|
||||
],
|
||||
"propertyNameAtParent": "socialTradingServerApps"
|
||||
}
|
||||
@@ -112,12 +112,6 @@
|
||||
"childType": "Tokens Mined",
|
||||
"autoAdd": true
|
||||
},
|
||||
{
|
||||
"name": "signingAccounts",
|
||||
"type": "node",
|
||||
"childType": "Signing Accounts",
|
||||
"autoAdd": false
|
||||
},
|
||||
{
|
||||
"name": "userApps",
|
||||
"type": "node",
|
||||
|
||||
@@ -38,9 +38,9 @@ function newGovernanceActionSwitch() {
|
||||
UI.projects.governance.functionLibraries.profileConstructor.buildProfile(action.node, action.rootNodes)
|
||||
break
|
||||
}
|
||||
case 'Install Secrets':
|
||||
case 'Install Signing Accounts':
|
||||
{
|
||||
UI.projects.governance.functionLibraries.profileConstructor.installSecrets(action.node, action.rootNodes)
|
||||
UI.projects.governance.functionLibraries.profileConstructor.installSigningAccounts(action.node, action.rootNodes)
|
||||
break
|
||||
}
|
||||
case 'Add Missing Plugin User Profiles':
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function newGovernanceFunctionLibraryProfileConstructor() {
|
||||
let thisObject = {
|
||||
buildProfile: buildProfile,
|
||||
installSecrets: installSecrets
|
||||
installSigningAccounts: installSigningAccounts
|
||||
}
|
||||
|
||||
return thisObject
|
||||
@@ -148,7 +148,7 @@ function newGovernanceFunctionLibraryProfileConstructor() {
|
||||
*/
|
||||
|
||||
const hasFork = UI.projects.governance.spaces.userProfileSpace.githubForks.get(githubUsername)
|
||||
if(hasFork === undefined) {
|
||||
if (hasFork === undefined) {
|
||||
// New user! Probably doesn't have a fork, so let's create it.
|
||||
let apisNode = UI.projects.foundations.spaces.designSpace.workspace.getHierarchyHeadByNodeType('APIs')
|
||||
if (apisNode === undefined) {
|
||||
@@ -186,7 +186,7 @@ function newGovernanceFunctionLibraryProfileConstructor() {
|
||||
if (err.result === GLOBAL.DEFAULT_OK_RESPONSE.result && data.result === GLOBAL.DEFAULT_OK_RESPONSE.result) {
|
||||
UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'Gov Message - Automated User Profile Contribute Done')
|
||||
} else {
|
||||
if (data.docs === undefined) {return}
|
||||
if (data.docs === undefined) { return }
|
||||
UI.projects.education.spaces.docsSpace.navigateTo(
|
||||
data.docs.project,
|
||||
data.docs.category,
|
||||
@@ -240,7 +240,7 @@ function newGovernanceFunctionLibraryProfileConstructor() {
|
||||
}
|
||||
}
|
||||
|
||||
function installSecrets(
|
||||
function installSigningAccounts(
|
||||
node,
|
||||
rootNodes
|
||||
) {
|
||||
@@ -270,21 +270,6 @@ 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
|
||||
)
|
||||
|
||||
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')
|
||||
@@ -387,15 +372,19 @@ function newGovernanceFunctionLibraryProfileConstructor() {
|
||||
|
||||
function createSigningAccount(signature) {
|
||||
|
||||
/*
|
||||
Delete Signing Account if it already exists.
|
||||
*/
|
||||
let rootNodes = UI.projects.foundations.spaces.designSpace.workspace.workspaceNode.rootNodes
|
||||
if (targetNode.signingAccount !== undefined) {
|
||||
UI.projects.visualScripting.functionLibraries.nodeDeleter.deleteUIObject(targetNode.signingAccount, rootNodes)
|
||||
}
|
||||
|
||||
let signingAccount = UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.addUIObject(
|
||||
signingAccounts,
|
||||
targetNode,
|
||||
'Signing Account',
|
||||
UI.projects.foundations.spaces.designSpace.workspace.workspaceNode.rootNodes
|
||||
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.
|
||||
*/
|
||||
|
||||
@@ -97,11 +97,6 @@ exports.newNetworkModulesUserProfiles = function newNetworkModulesUserProfiles()
|
||||
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')
|
||||
@@ -111,25 +106,20 @@ exports.newNetworkModulesUserProfiles = function newNetworkModulesUserProfiles()
|
||||
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()
|
||||
checkNwetworkClients(algoTradersPlatform)
|
||||
checkNwetworkClients(socialTradingDesktopApp)
|
||||
checkNwetworkClients(socialTradingMobileApp)
|
||||
checkNwetworkClients(socialTradingServerApp)
|
||||
checkNwetworkClients(socialTradingBots)
|
||||
checkNwetworkClients(socialPersonas)
|
||||
checkNwetworkClients(p2pNetworkNodes)
|
||||
|
||||
addToNetworkClientMap(algoTradersPlatform)
|
||||
addToNetworkClientMap(socialTradingDesktopApp)
|
||||
addToNetworkClientMap(socialTradingMobileApp)
|
||||
addToNetworkClientMap(socialTradingServerApp)
|
||||
addToNetworkClientMap(socialTradingBots)
|
||||
addToNetworkClientMap(socialPersonas)
|
||||
addToNetworkClientMap(p2pNetworkNodes)
|
||||
function checkNwetworkClients(netwokClients) {
|
||||
|
||||
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]
|
||||
for (let j = 0; j < netwokClients.length; j++) {
|
||||
let networkClient = netwokClients[j]
|
||||
let signingAccount = networkClient.signingAccount
|
||||
if (signingAccount === undefined) { continue }
|
||||
let config = JSON.parse(signingAccount.config)
|
||||
let signatureObject = config.signature
|
||||
let web3 = new SA.nodeModules.web3()
|
||||
@@ -138,19 +128,15 @@ exports.newNetworkModulesUserProfiles = function newNetworkModulesUserProfiles()
|
||||
/*
|
||||
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
|
||||
networkClient.type === "P2P Network Node" &&
|
||||
networkClient.config !== undefined
|
||||
) {
|
||||
let config
|
||||
try {
|
||||
config = JSON.parse(signingAccount.referenceParent.config)
|
||||
config = JSON.parse(networkClient.config)
|
||||
} catch (err) {
|
||||
console.log('P2P Network Node Config not in JSON format. userProfileHandle = ' + userHandle + ' NodeId = ' + signingAccount.referenceParent.id)
|
||||
console.log('P2P Network Node Config not in JSON format. userProfileHandle = ' + userHandle + ' NodeId = ' + networkClient.id)
|
||||
continue
|
||||
}
|
||||
if (config.host === undefined) {
|
||||
@@ -161,22 +147,22 @@ exports.newNetworkModulesUserProfiles = function newNetworkModulesUserProfiles()
|
||||
}
|
||||
|
||||
let p2pNetworkNode = SA.projects.network.modules.p2pNetworkNode.newNetworkModulesP2PNetworkNode()
|
||||
p2pNetworkNode.initialize(signingAccount.referenceParent, userProfile, blockchainAccount)
|
||||
p2pNetworkNode.initialize(networkClient, 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
|
||||
networkClient.id === SA.secrets.map.get(nodeCodeName).nodeId
|
||||
) {
|
||||
p2pNetworkIdentity.node = signingAccount.referenceParent
|
||||
p2pNetworkIdentity.node = networkClient
|
||||
p2pNetworkIdentity.blockchainAccount = blockchainAccount
|
||||
p2pNetworkIdentity.userProfile = userProfile
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user