From a5870be334452cf028141f58707f4a7bf7ddd0d1 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 10 Nov 2020 11:02:30 +0100 Subject: [PATCH] Tokens --- Projects/Ethereum/Schemas/AppSchema.json | 213 +++++++++++++++++- .../Function-Libraries/ActionSwitch.js | 2 +- .../Function-Libraries/UiObjectsFromNodes.js | 4 +- 3 files changed, 205 insertions(+), 14 deletions(-) diff --git a/Projects/Ethereum/Schemas/AppSchema.json b/Projects/Ethereum/Schemas/AppSchema.json index 2528bb9fc..de049e025 100644 --- a/Projects/Ethereum/Schemas/AppSchema.json +++ b/Projects/Ethereum/Schemas/AppSchema.json @@ -14,6 +14,12 @@ "relatedUiObject": "Decentralized Application", "actionFunction": "payload.executeAction" }, + { + "action": "Add UI Object", + "label": "Add Ethereum Tokens", + "relatedUiObject": "Ethereum Tokens", + "actionFunction": "payload.executeAction" + }, { "action": "Delete UI Object", "askConfirmation": true, @@ -31,6 +37,202 @@ "positionLocked": true, "icon": "ethereum" }, + { + "type": "Ethereum Tokens", + "menuItems": [ + { + "action": "Add Missing Children", + "label": "Add Missing Children", + "relatedUiObject": "Ethereum Tokens", + "actionFunction": "payload.executeAction" + }, + { + "action": "Delete UI Object", + "askConfirmation": true, + "confirmationLabel": "Confirm to Delete", + "label": "Delete", + "iconPathOn": "delete", + "iconPathOff": "delete", + "actionFunction": "payload.executeAction" + } + ], + "isHierarchyHead": true, + "addLeftIcons": true, + "level": 0, + "properties": [ + { + "name": "erc-20TokenType", + "type": "node", + "childType": "ERC-20 Token Type" + }, + { + "name": "erc-223TokenType", + "type": "node", + "childType": "ERC-223 Token Type" + }, + { + "name": "erc-721TokenType", + "type": "node", + "childType": "ERC-721 Token Type" + }, + { + "name": "erc-777TokenType", + "type": "node", + "childType": "ERC-777 Token Type" + } + ], + "icon": "ethereum" + }, + { + "type": "ERC-20 Token Type", + "menuItems": [ + { + "action": "Add UI Object", + "label": "Add Token Definition", + "relatedUiObject": "Token Definition", + "actionFunction": "payload.executeAction" + }, + { + "action": "Delete UI Object", + "askConfirmation": true, + "confirmationLabel": "Confirm to Delete", + "label": "Delete", + "iconPathOn": "delete", + "iconPathOff": "delete", + "actionFunction": "payload.executeAction" + } + ], + "addLeftIcons": true, + "level": 1, + "properties": [ + { + "name": "tokenDefinition", + "type": "node", + "childType": "Token Definition" + } + ], + "icon": "ethereum" + }, + { + "type": "ERC-223 Token Type", + "menuItems": [ + { + "action": "Add UI Object", + "label": "Add Token Definition", + "relatedUiObject": "Token Definition", + "actionFunction": "payload.executeAction" + }, + { + "action": "Delete UI Object", + "askConfirmation": true, + "confirmationLabel": "Confirm to Delete", + "label": "Delete", + "iconPathOn": "delete", + "iconPathOff": "delete", + "actionFunction": "payload.executeAction" + } + ], + "addLeftIcons": true, + "level": 1, + "properties": [ + { + "name": "tokenDefinition", + "type": "node", + "childType": "Token Definition" + } + ], + "icon": "ethereum" + }, + { + "type": "ERC-721 Token Type", + "menuItems": [ + { + "action": "Add UI Object", + "label": "Add Token Definition", + "relatedUiObject": "Token Definition", + "actionFunction": "payload.executeAction" + }, + { + "action": "Delete UI Object", + "askConfirmation": true, + "confirmationLabel": "Confirm to Delete", + "label": "Delete", + "iconPathOn": "delete", + "iconPathOff": "delete", + "actionFunction": "payload.executeAction" + } + ], + "addLeftIcons": true, + "level": 1, + "properties": [ + { + "name": "tokenDefinition", + "type": "node", + "childType": "Token Definition" + } + ], + "icon": "ethereum" + }, + { + "type": "ERC-777 Token Type", + "menuItems": [ + { + "action": "Add UI Object", + "label": "Add Token Definition", + "relatedUiObject": "Token Definition", + "actionFunction": "payload.executeAction" + }, + { + "action": "Delete UI Object", + "askConfirmation": true, + "confirmationLabel": "Confirm to Delete", + "label": "Delete", + "iconPathOn": "delete", + "iconPathOff": "delete", + "actionFunction": "payload.executeAction" + } + ], + "addLeftIcons": true, + "level": 1, + "properties": [ + { + "name": "tokenDefinition", + "type": "node", + "childType": "Token Definition" + } + ], + "icon": "ethereum" + }, + { + "type": "Token Definition", + "menuItems": [ + { + "action": "Add UI Object", + "label": "Add Smart Contract", + "relatedUiObject": "Smart Contract", + "actionFunction": "payload.executeAction" + }, + { + "action": "Delete UI Object", + "askConfirmation": true, + "confirmationLabel": "Confirm to Delete", + "label": "Delete", + "iconPathOn": "delete", + "iconPathOff": "delete", + "actionFunction": "payload.executeAction" + } + ], + "addLeftIcons": true, + "level": 2, + "properties": [ + { + "name": "smartContract", + "type": "node", + "childType": "Smart Contract" + } + ], + "icon": "ethereum" + }, { "type": "Ethereum Blockchain", "menuItems": [ @@ -107,17 +309,6 @@ "dontShowAtFullscreen": true, "actionFunction": "uiObject.configEditor.activate" }, - { - "action": "Install Geth", - "actionProject": "Ethereum", - "label": "Install Geth", - "askConfirmation": true, - "confirmationLabel": "Confirm to Run", - "workDoneLabel": "Run Request Sent", - "iconPathOn": "run", - "iconPathOff": "run", - "actionFunction": "payload.executeAction" - }, { "action": "Delete UI Object", "askConfirmation": true, diff --git a/Projects/Superalgos/Function-Libraries/ActionSwitch.js b/Projects/Superalgos/Function-Libraries/ActionSwitch.js index f4d063bde..30de8ad99 100644 --- a/Projects/Superalgos/Function-Libraries/ActionSwitch.js +++ b/Projects/Superalgos/Function-Libraries/ActionSwitch.js @@ -148,7 +148,7 @@ function newSuperalgosActionSwitch() { break case 'Add Missing Children': { - functionLibraryUiObjectsFromNodes.addMissingChildren(action.node) + functionLibraryUiObjectsFromNodes.addMissingChildren(action.node, action.rootNodes) } break case 'Delete UI Object': diff --git a/Projects/Superalgos/Function-Libraries/UiObjectsFromNodes.js b/Projects/Superalgos/Function-Libraries/UiObjectsFromNodes.js index c6f131a9c..4e0d078d8 100644 --- a/Projects/Superalgos/Function-Libraries/UiObjectsFromNodes.js +++ b/Projects/Superalgos/Function-Libraries/UiObjectsFromNodes.js @@ -477,7 +477,7 @@ function newUiObjectsFromNodes() { return object } - function addMissingChildren(node) { + function addMissingChildren(node, rootNodes) { let nodeDefinition = getNodeDefinition(node) /* Connect to Parent */ @@ -488,7 +488,7 @@ function newUiObjectsFromNodes() { if (property.type === 'node') { if (property.name !== previousPropertyName) { if (node[property.name] === undefined) { - addUIObject(node, property.childType) + addUIObject(node, property.childType, rootNodes) previousPropertyName = property.name } }