diff --git a/Projects/Governance/Icons/signature.png b/Projects/Governance/Icons/signature.png new file mode 100644 index 000000000..ef69b801e Binary files /dev/null and b/Projects/Governance/Icons/signature.png differ diff --git a/Projects/Governance/Schemas/App-Schema/Signature.json b/Projects/Governance/Schemas/App-Schema/Signature.json new file mode 100644 index 000000000..0977983ea --- /dev/null +++ b/Projects/Governance/Schemas/App-Schema/Signature.json @@ -0,0 +1,33 @@ +{ + "type": "Signature", + "menuItems": [ + { + "action": "Configure", + "actionFunction": "uiObject.configEditor.activate", + "label": "Configure", + "iconPathOn": "configuration", + "iconPathOff": "configuration" + }, + { + "action": "Delete UI Object", + "actionProject": "Foundations", + "askConfirmation": true, + "confirmationLabel": "Confirm to Delete", + "label": "Delete", + "iconPathOn": "delete-entity", + "iconPathOff": "delete-entity", + "actionFunction": "payload.executeAction" + } + ], + "editors": { + "config": true + }, + "initialValues": { + "config": "{ \"privateKey\": \"\"}" + }, + "addLeftIcons": true, + "level": 2, + "referencingRules": { + "compatibleTypes": "->User Profile->" + } +} \ No newline at end of file diff --git a/Projects/Governance/Schemas/App-Schema/user-profile.json b/Projects/Governance/Schemas/App-Schema/user-profile.json index 53f1dafea..d966c9166 100644 --- a/Projects/Governance/Schemas/App-Schema/user-profile.json +++ b/Projects/Governance/Schemas/App-Schema/user-profile.json @@ -35,6 +35,13 @@ "label": "Add User Referrer", "relatedUiObject": "User Referrer" }, + { + "action": "Add UI Object", + "actionProject": "Signature", + "actionFunction": "payload.executeAction", + "label": "Add Signature", + "relatedUiObject": "Add Signature" + }, { "action": "Delete UI Object", "actionProject": "Foundations", diff --git a/Projects/Governance/UI/Spaces/User-Profile-Space/UserProfile.js b/Projects/Governance/UI/Spaces/User-Profile-Space/UserProfile.js index 1b2144f17..2480eb542 100644 --- a/Projects/Governance/UI/Spaces/User-Profile-Space/UserProfile.js +++ b/Projects/Governance/UI/Spaces/User-Profile-Space/UserProfile.js @@ -14,6 +14,8 @@ function newGovernanceUserProfileSpace() { thisObject.container.initialize(MODULE_NAME) thisObject.container.isDraggeable = false + waitingForResponses = 0 + return thisObject function initialize() { @@ -40,7 +42,7 @@ function newGovernanceUserProfileSpace() { function physics() { if (UI.projects.foundations.spaces.designSpace.workspace === undefined) { return } let userProfiles = UI.projects.foundations.spaces.designSpace.workspace.getHierarchyHeadsByNodeType('User Profile') - + if (waitingForResponses !== 0) { return } /* We will get all the user Profiles tokens from the blockchain, making a call every 5 seconds so as not to exceed the rate limit. @@ -62,6 +64,7 @@ function newGovernanceUserProfileSpace() { function getBlockchainTokens(userProfile) { let blockchainAccount = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(userProfile.payload, 'blockchainAccount') const url = "https://api.bscscan.com/api?module=account&action=tokenbalance&contractaddress=0xfb981ed9a92377ca4d75d924b9ca06df163924fd&address=" + blockchainAccount + "&tag=latest&apikey=YourApiKeyToken" + waitingForResponses++ fetch(url).then(function (response) { return response.json(); @@ -69,8 +72,12 @@ function newGovernanceUserProfileSpace() { console.log(data) userProfile.payload.uiObject.setInfoMessage(data) userProfile.payload.blockchainTokens = Number(data.result) / 1000000000000000000 + waitingForResponses-- }).catch(function (err) { + userProfile.payload.blockchainTokens = 0 + console.log(err) userProfile.payload.uiObject.setErrorMessage(err.message) + waitingForResponses-- }); } }