My profile with signing accounts for each Superalgos product

This commit is contained in:
Luis Fernando Molina committed 2021-09-21 19:09:12 +02:00
1 parent f9ac2761d2
commit e3f8d25328
7 files changed
+320 -90

No files matched your search

+1
View File
@@ -3,6 +3,7 @@ Log-Files
My-Workspaces
My-Social-Trading-Data
My-Network-Nodes-Data
My-Secrets
debug.log
.DS_Store
*.db
@@ -127,12 +127,12 @@
"id": "f4d39b02-4324-438d-9f74-2bea2b7272ef",
"savedPayload": {
"position": {
"x": 10242.705098312485,
"y": 21727.335575687743
"x": 10476.335575687743,
"y": 24007.294901687517
},
"targetPosition": {
"x": 10000,
"y": 21551
"x": 10300,
"y": 24250
},
"floatingObject": {
"isPinned": false,
@@ -516,12 +516,12 @@
"id": "b6e3c87d-a11b-4b2a-b6a6-edc96375f5da",
"savedPayload": {
"position": {
"x": 10092.705098312485,
"y": 21836.316954888545
"x": 10585.316954888545,
"y": 24157.294901687517
},
"targetPosition": {
"x": 10000,
"y": 21551
"x": 10300,
"y": 24250
},
"floatingObject": {
"isPinned": false,
@@ -12448,12 +12448,12 @@
"id": "bb390957-b8a2-4a8a-9fbf-963ea20f6eaf",
"savedPayload": {
"position": {
"x": 9907.294901687515,
"y": 21836.316954888545
"x": 10585.316954888545,
"y": 24342.705098312483
},
"targetPosition": {
"x": 10000,
"y": 21551
"x": 10300,
"y": 24250
},
"floatingObject": {
"isPinned": false,
@@ -12508,12 +12508,12 @@
"id": "b046f4e4-40b1-4e47-8fed-75a6a5c6029d",
"savedPayload": {
"position": {
"x": 9635.273908764775,
"y": 22001.399212980523
"x": 10750.399212980523,
"y": 24614.72609123522
},
"targetPosition": {
"x": 9757.294901687515,
"y": 21727.335575687743
"x": 10476.335575687743,
"y": 24492.705098312483
},
"floatingObject": {
"isPinned": false,
@@ -12549,7 +12549,7 @@
"userDelegates": [
{
"type": "User Delegate",
"name": "PLuv",
"name": "",
"config": "{}",
"project": "Governance",
"id": "a2bbd553-e24c-44b8-a199-83114476ce24",
@@ -12621,7 +12621,7 @@
"userDelegates": [
{
"type": "User Delegate",
"name": "harrellbm",
"name": "",
"config": "{}",
"project": "Governance",
"id": "2c79cd42-28a7-4a4b-ad3b-a8a29e993697",
@@ -12693,7 +12693,7 @@
"userDelegates": [
{
"type": "User Delegate",
"name": "Raplh2502",
"name": "",
"config": "{}",
"project": "Governance",
"id": "94f99114-fc01-450e-9d9d-0b62c8ea393f",
@@ -12765,7 +12765,7 @@
"userDelegates": [
{
"type": "User Delegate",
"name": "cozed-gh",
"name": "",
"config": "{}",
"project": "Governance",
"id": "ee1b374b-d4af-494c-93b8-3f83849d85f2",
@@ -12837,7 +12837,7 @@
"userDelegates": [
{
"type": "User Delegate",
"name": "Smidy13",
"name": "",
"config": "{}",
"project": "Governance",
"id": "6a843bed-6392-4981-9e27-eff22f0f9fb1",
@@ -12909,7 +12909,7 @@
"userDelegates": [
{
"type": "User Delegate",
"name": "ssplatt",
"name": "",
"config": "{}",
"project": "Governance",
"id": "b053ef35-1efe-46f4-81b2-d0c2e8ad0732",
@@ -13007,12 +13007,12 @@
"id": "681ff42a-d5af-4fed-971e-935398dac2aa",
"savedPayload": {
"position": {
"x": 9270.142215762084,
"y": 21991.83790310513
"x": 10740.83790310513,
"y": 24979.857784237916
},
"targetPosition": {
"x": 9458.938333077034,
"y": 21758.69411466804
"x": 10507.694114668038,
"y": 24791.061666922964
},
"floatingObject": {
"isPinned": false,
@@ -13042,12 +13042,12 @@
"id": "ff3bc7ad-6051-4246-99fa-1210a3378a29",
"savedPayload": {
"position": {
"x": 8862.225195856072,
"y": 21821.411192628635
"x": 10570.41119262863,
"y": 25387.774804143926
},
"targetPosition": {
"x": 9160.581764466553,
"y": 21790.052653648338
"x": 10539.052653648334,
"y": 25089.418235533445
},
"floatingObject": {
"isPinned": false,
@@ -13066,12 +13066,12 @@
"id": "7f642170-d60b-41bc-85ae-dc64fbfc8b4c",
"savedPayload": {
"position": {
"x": 9160.581764466553,
"y": 21790.052653648338
"x": 10539.052653648334,
"y": 25089.418235533445
},
"targetPosition": {
"x": 9458.938333077034,
"y": 21758.69411466804
"x": 10507.694114668038,
"y": 24791.061666922964
},
"floatingObject": {
"isPinned": false,
@@ -13094,12 +13094,12 @@
"id": "e4be3ce4-3569-4d97-8d54-95bb4cfcb0c5",
"savedPayload": {
"position": {
"x": 9225.794544639943,
"y": 21569.897997353088
"x": 10318.897997353088,
"y": 25024.205455360054
},
"targetPosition": {
"x": 9458.938333077034,
"y": 21758.69411466804
"x": 10507.694114668038,
"y": 24791.061666922964
},
"floatingObject": {
"isPinned": false,
@@ -13117,12 +13117,12 @@
"id": "3ff7f410-911d-4cb8-9094-d816dee4dccb",
"savedPayload": {
"position": {
"x": 9458.938333077034,
"y": 21758.69411466804
"x": 10507.694114668038,
"y": 24791.061666922964
},
"targetPosition": {
"x": 9757.294901687515,
"y": 21727.335575687743
"x": 10476.335575687743,
"y": 24492.705098312483
},
"floatingObject": {
"isPinned": false,
@@ -13140,12 +13140,12 @@
"id": "4f35322c-3e7d-49f8-9706-10bf71f0d420",
"savedPayload": {
"position": {
"x": 9757.294901687515,
"y": 21727.335575687743
"x": 10476.335575687743,
"y": 24492.705098312483
},
"targetPosition": {
"x": 10000,
"y": 21551
"x": 10300,
"y": 24250
},
"floatingObject": {
"isPinned": false,
@@ -13163,18 +13163,18 @@
"id": "f8182a9c-f830-4ec1-a238-ac3a5efd69e6",
"savedPayload": {
"position": {
"x": 10000,
"y": 21551
"x": 10300,
"y": 24250
},
"targetPosition": {
"x": 10000,
"y": 21251
"y": 24250
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
@@ -13190,12 +13190,181 @@
"id": "9870ca2a-cefc-484b-b7fc-206d62782ebc",
"savedPayload": {
"position": {
"x": 9700,
"y": 21251
"x": 9850,
"y": 24509.807621135333
},
"targetPosition": {
"x": 10000,
"y": 21251
"y": 24250
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"signingAccounts": {
"type": "Signing Accounts",
"name": "New Signing Accounts",
"project": "Governance",
"signingAccounts": [
{
"type": "Signing Account",
"name": "Social Trading Desktop",
"config": "{\n \"signature\": {\n \"message\": \"Luis-Fernando-Molina\",\n \"messageHash\": \"0x443abf3389e332a62d21b84dd12e271cb428d334195d3aeb986ca85ee53cccb9\",\n \"v\": \"0x1c\",\n \"r\": \"0x44cba4eeebb7f8bfb0d9fedb8b3c5c34ecd75b69969766435ae641547a8158c4\",\n \"s\": \"0x144b9076038085fa5fa51c381e76377cd2bcc87c835698eeb5195cceefb63ead\",\n \"signature\": \"0x44cba4eeebb7f8bfb0d9fedb8b3c5c34ecd75b69969766435ae641547a8158c4144b9076038085fa5fa51c381e76377cd2bcc87c835698eeb5195cceefb63ead1c\"\n }\n}",
"project": "Governance",
"id": "30858b11-5b8d-46c6-97f8-765e3676fc2f",
"savedPayload": {
"position": {
"x": 9550,
"y": 23990.192378864667
},
"targetPosition": {
"x": 9850,
"y": 23990.192378864667
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
{
"type": "Signing Account",
"name": "Social Trading Server",
"config": "{\n \"signature\": {\n \"message\": \"Luis-Fernando-Molina\",\n \"messageHash\": \"0x443abf3389e332a62d21b84dd12e271cb428d334195d3aeb986ca85ee53cccb9\",\n \"v\": \"0x1b\",\n \"r\": \"0xc56bbcd7a99f47e20c5d83b1d4c102e1c7a223267b76f53200ff87fea7964e95\",\n \"s\": \"0x3e730a7d40a13199ef59f7a2a06a9d43da8f918e37afd6f706eceaea1fa8ed2d\",\n \"signature\": \"0xc56bbcd7a99f47e20c5d83b1d4c102e1c7a223267b76f53200ff87fea7964e953e730a7d40a13199ef59f7a2a06a9d43da8f918e37afd6f706eceaea1fa8ed2d1b\"\n }\n}",
"project": "Governance",
"id": "beff2691-f55f-401c-87a7-f6f7e59ebfb0",
"savedPayload": {
"position": {
"x": 9590.192378864669,
"y": 23840.192378864667
},
"targetPosition": {
"x": 9850,
"y": 23990.192378864667
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
{
"type": "Signing Account",
"name": "Social Trading Mobile",
"config": "{\n \"signature\": {\n \"message\": \"Luis-Fernando-Molina\",\n \"messageHash\": \"0x443abf3389e332a62d21b84dd12e271cb428d334195d3aeb986ca85ee53cccb9\",\n \"v\": \"0x1c\",\n \"r\": \"0x502693fda93e9331e1eb1f5f6bd2896f6175d86816d11437ab8f4c51bdb95c5c\",\n \"s\": \"0x3c901bdb9f56f97cf558159c0f57c94dcade020a992be74a955a2cddf88047e1\",\n \"signature\": \"0x502693fda93e9331e1eb1f5f6bd2896f6175d86816d11437ab8f4c51bdb95c5c3c901bdb9f56f97cf558159c0f57c94dcade020a992be74a955a2cddf88047e11c\"\n }\n}",
"project": "Governance",
"id": "5828093e-65e1-4b18-9cbc-9ff33c98acc1",
"savedPayload": {
"position": {
"x": 9700,
"y": 23730.384757729335
},
"targetPosition": {
"x": 9850,
"y": 23990.192378864667
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
{
"type": "Signing Account",
"name": "Social Trading Platform",
"config": "{\n \"signature\": {\n \"message\": \"Luis-Fernando-Molina\",\n \"messageHash\": \"0x443abf3389e332a62d21b84dd12e271cb428d334195d3aeb986ca85ee53cccb9\",\n \"v\": \"0x1c\",\n \"r\": \"0x363cd2c23617b65f0314a6b1b34c515e0fed9b2da62d53f2cf2609c1bc25e7fb\",\n \"s\": \"0x5e72414fcfe8a1308d7d82f275b3922cfe738374ed74e67086c59cfe7b6c0a24\",\n \"signature\": \"0x363cd2c23617b65f0314a6b1b34c515e0fed9b2da62d53f2cf2609c1bc25e7fb5e72414fcfe8a1308d7d82f275b3922cfe738374ed74e67086c59cfe7b6c0a241c\"\n }\n}",
"project": "Governance",
"id": "fa5647f8-42bc-4d7b-8137-401ac8b5433c",
"savedPayload": {
"position": {
"x": 9850,
"y": 23690.192378864667
},
"targetPosition": {
"x": 9850,
"y": 23990.192378864667
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
{
"type": "Signing Account",
"name": "P2P Network Node",
"config": "{\n \"signature\": {\n \"message\": \"Luis-Fernando-Molina\",\n \"messageHash\": \"0x443abf3389e332a62d21b84dd12e271cb428d334195d3aeb986ca85ee53cccb9\",\n \"v\": \"0x1b\",\n \"r\": \"0x1df7b43b26e14a886b0702f3a43bfa7e078a3603a54d5befeb83ae451e423267\",\n \"s\": \"0x19cb2e7ba38cf49e5baa6ea20cbf895e86c9e010217a3f42e4df46b7b4e0bf36\",\n \"signature\": \"0x1df7b43b26e14a886b0702f3a43bfa7e078a3603a54d5befeb83ae451e42326719cb2e7ba38cf49e5baa6ea20cbf895e86c9e010217a3f42e4df46b7b4e0bf361b\"\n }\n}",
"project": "Governance",
"id": "e7066d66-9e36-4f38-963e-76b915b38c43",
"savedPayload": {
"position": {
"x": 10000,
"y": 23730.384757729335
},
"targetPosition": {
"x": 9850,
"y": 23990.192378864667
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
}
],
"id": "1aae1fa4-e5cf-48de-a25e-20001523da70",
"savedPayload": {
"position": {
"x": 9850,
"y": 23990.192378864667
},
"targetPosition": {
"x": 10000,
"y": 24250
},
"floatingObject": {
"isPinned": false,
@@ -13213,17 +13382,17 @@
"id": "a8de78f0-c3e4-4a2a-b7e8-f659073969db",
"savedPayload": {
"position": {
"x": 39655.1724137931,
"y": 18250
"x": 10000,
"y": 24250
},
"targetPosition": {
"x": 39655.1724137931,
"y": 18250
"x": 10000,
"y": 24250
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": true,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
@@ -62,12 +62,12 @@
"id": "baa2f02c-2920-4edb-a103-d452fc61d82f",
"savedPayload": {
"position": {
"x": 29310.344827586196,
"y": 24250
"x": 30000,
"y": 18250
},
"targetPosition": {
"x": 29310.344827586196,
"y": 24250
"x": 30000,
"y": 18250
},
"floatingObject": {
"isPinned": false,
@@ -62,11 +62,11 @@
"id": "36c2b050-631f-4291-987c-418adc94317d",
"savedPayload": {
"position": {
"x": 27586.206896551714,
"x": 40000,
"y": 21250
},
"targetPosition": {
"x": 27586.206896551714,
"x": 40000,
"y": 21250
},
"floatingObject": {
@@ -23,7 +23,7 @@
"addLeftIcons": true,
"level": 2,
"attachingRules": {
"compatibleTypes": "->User Profile->"
"compatibleTypes": "->Signing Accounts->"
},
"editors": {
"config": true
@@ -31,5 +31,5 @@
"initialValues": {
"config": "{}"
},
"propertyNameAtParent": "signingAccount"
"propertyNameAtParent": "signingAccounts"
}
@@ -161,8 +161,18 @@ function newGovernanceFunctionLibraryProfileConstructor() {
node,
rootNodes
) {
let githubUsername = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(node.payload, 'githubUsername')
let mnemonic = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(node.payload, 'mnemonic')
let signingAccounts
if (githubUsername === undefined || githubUsername === "") {
node.payload.uiObject.setErrorMessage(
"githubUsername config property missing.",
UI.projects.governance.globals.designer.SET_ERROR_COUNTER_FACTOR
)
return
}
/*
Some validations first...
*/
@@ -240,35 +250,81 @@ function newGovernanceFunctionLibraryProfileConstructor() {
}
}
createSigningAccount(response.address, response.privateKey)
signUserProfileData(response.address, response.privateKey)
}
}
function createSigningAccount(address, privateKey) {
function signUserProfileData(address, privateKey) {
let signingAccount = UI.projects.foundations.functionLibraries.uiObjectsFromNodes.addUIObject(
signingAccounts,
'Signing Account',
UI.projects.foundations.spaces.designSpace.workspace.workspaceNode.rootNodes
)
/*
We store at the User Profile the Signed githubUsername
*/
UI.projects.foundations.utilities.nodeConfig.saveConfigProperty(signingAccount.payload, 'address', address)
UI.projects.foundations.utilities.nodeConfig.saveConfigProperty(node.payload, 'privateKey', privateKey)
/*
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 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) {
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)
}
function createSigningAccount(signature) {
let signingAccount = UI.projects.foundations.functionLibraries.uiObjectsFromNodes.addUIObject(
signingAccounts,
'Signing Account',
UI.projects.foundations.spaces.designSpace.workspace.workspaceNode.rootNodes
)
/*
We store at the User Profile the Signed githubUsername
*/
UI.projects.foundations.utilities.nodeConfig.saveConfigProperty(signingAccount.payload, 'signature', signature)
node.config = "{}"
UI.projects.foundations.utilities.nodeConfig.saveConfigProperty(node.payload, 'nodeName', signingAccount.name)
UI.projects.foundations.utilities.nodeConfig.saveConfigProperty(node.payload, 'nodeType', signingAccount.type)
UI.projects.foundations.utilities.nodeConfig.saveConfigProperty(node.payload, 'nodeId', signingAccount.id)
UI.projects.foundations.utilities.nodeConfig.saveConfigProperty(node.payload, 'address', address)
UI.projects.foundations.utilities.nodeConfig.saveConfigProperty(node.payload, 'privateKey', privateKey)
UI.projects.foundations.utilities.nodeConfig.saveConfigProperty(node.payload, 'githubUsername', githubUsername)
/*
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
)
}
}
}
}
@@ -187,6 +187,7 @@ function newGovernanceFunctionLibraryTokenPower() {
if (childNode === undefined) { continue }
if (childNode.type === "Delegation Program" && excludeDelegationProgram === true) { continue }
if (childNode.type === "Tokens Mined") { continue }
if (childNode.type === "Signing Accounts") { continue }
let percentage = getPercentage(childNode)
@@ -205,6 +206,7 @@ function newGovernanceFunctionLibraryTokenPower() {
if (childNode === undefined) { continue }
if (childNode.type === "Delegation Program" && excludeDelegationProgram === true) { continue }
if (childNode.type === "Tokens Mined") { continue }
if (childNode.type === "Signing Accounts") { continue }
let percentage = getPercentage(childNode)
if (percentage !== undefined && isNaN(percentage) !== true) {
@@ -241,6 +243,7 @@ function newGovernanceFunctionLibraryTokenPower() {
if (childNode === undefined) { continue }
if (childNode.type === "Delegation Program" && excludeDelegationProgram === true) { continue }
if (childNode.type === "Tokens Mined") { continue }
if (childNode.type === "Signing Accounts") { continue }
let percentage = getPercentage(childNode)
if (percentage === undefined || isNaN(percentage) === true) {
@@ -262,6 +265,7 @@ function newGovernanceFunctionLibraryTokenPower() {
if (childNode === undefined) { continue }
if (childNode.type === "Delegation Program" && excludeDelegationProgram === true) { continue }
if (childNode.type === "Tokens Mined") { continue }
if (childNode.type === "Signing Accounts") { continue }
let percentage = getPercentage(childNode)
if (percentage === undefined || isNaN(percentage) === true) {