From 22dc7a774c57e80f975dc52617396224da0315ee Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 17 Jun 2021 19:29:20 +0200 Subject: [PATCH 1/2] GOvernance Bug Fix at request tos BSC SCAN breaking rate limit --- .../Spaces/User-Profile-Space/UserProfile.js | 4 +-- UI/Utilities.js | 36 ++++++++++--------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/Projects/Governance/UI/Spaces/User-Profile-Space/UserProfile.js b/Projects/Governance/UI/Spaces/User-Profile-Space/UserProfile.js index 1a5425677..0dce00174 100644 --- a/Projects/Governance/UI/Spaces/User-Profile-Space/UserProfile.js +++ b/Projects/Governance/UI/Spaces/User-Profile-Space/UserProfile.js @@ -14,7 +14,8 @@ function newGovernanceUserProfileSpace() { thisObject.container.initialize(MODULE_NAME) thisObject.container.isDraggeable = false - waitingForResponses = 0 + let waitingForResponses = 0 + let timer = 0 return thisObject @@ -47,7 +48,6 @@ function newGovernanceUserProfileSpace() { 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. */ - let timer = 0 for (let i = 0; i < userProfiles.length; i++) { let userProfile = userProfiles[i] if (userProfile.payload === undefined) { continue } diff --git a/UI/Utilities.js b/UI/Utilities.js index eab199c2a..77231f851 100644 --- a/UI/Utilities.js +++ b/UI/Utilities.js @@ -107,27 +107,31 @@ function newUniqueId() { } function splitTextIntoPhrases(text, wordsPerLine) { - let splittedLabel = text.split(' ') - let phrases = [] - let phrase = '' - let wordCount = 0 - for (let i = 0; i < splittedLabel.length; i++) { - phrase = phrase + splittedLabel[i] - wordCount++ + try { + let splittedLabel = text.split(' ') + let phrases = [] + let phrase = '' + let wordCount = 0 + for (let i = 0; i < splittedLabel.length; i++) { + phrase = phrase + splittedLabel[i] + wordCount++ - if (i < splittedLabel.length - 1 && wordCount < wordsPerLine) { - phrase = phrase + ' ' + if (i < splittedLabel.length - 1 && wordCount < wordsPerLine) { + phrase = phrase + ' ' + } + if (wordCount >= wordsPerLine) { + phrases.push(phrase) + phrase = '' + wordCount = 0 + } } - if (wordCount >= wordsPerLine) { + if (wordCount > 0) { phrases.push(phrase) - phrase = '' - wordCount = 0 } + return phrases + } catch (err) { + console.log(err.stack) } - if (wordCount > 0) { - phrases.push(phrase) - } - return phrases } function getTextWidth(text) { From 835d8368a902bdf95b7d9a8261432ef6f91d098b Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 17 Jun 2021 19:52:10 +0200 Subject: [PATCH 2/2] Governance bug fixed with profile signing --- .../UI/Spaces/Floating-Space/CircularMenuItem.js | 2 +- .../UI/Function-Libraries/ProfileConstructor.js | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Projects/Foundations/UI/Spaces/Floating-Space/CircularMenuItem.js b/Projects/Foundations/UI/Spaces/Floating-Space/CircularMenuItem.js index 0b42737cc..e0e99082b 100644 --- a/Projects/Foundations/UI/Spaces/Floating-Space/CircularMenuItem.js +++ b/Projects/Foundations/UI/Spaces/Floating-Space/CircularMenuItem.js @@ -325,7 +325,7 @@ function newCircularMenuItem() { /* The first click ask for confirmation. */ if (temporaryStatus === STATUS_NO_ACTION_TAKEN_YET) { - setStatus(thisObject.confirmationLabel, UI_COLOR.GOLDEN_ORANGE, 100, STATUS_WAITING_CONFIRMATION) + setStatus(thisObject.confirmationLabel, UI_COLOR.GOLDEN_ORANGE, 250, STATUS_WAITING_CONFIRMATION) return } /* A Click during confirmation executes the pre-defined action. */ diff --git a/Projects/Governance/UI/Function-Libraries/ProfileConstructor.js b/Projects/Governance/UI/Function-Libraries/ProfileConstructor.js index 48106de7e..0cb3f4a2f 100644 --- a/Projects/Governance/UI/Function-Libraries/ProfileConstructor.js +++ b/Projects/Governance/UI/Function-Libraries/ProfileConstructor.js @@ -24,7 +24,6 @@ function newGovernanceFunctionLibraryProfileConstructor() { } createNewAccount() - signUserProfileData() function createNewAccount() { let params = { @@ -52,15 +51,11 @@ function newGovernanceFunctionLibraryProfileConstructor() { return } - UI.projects.foundations.utilities.nodeConfig.saveConfigProperty(node.payload, 'address', response.address) - UI.projects.foundations.utilities.nodeConfig.saveConfigProperty(node.payload, 'privateKey', response.privateKey) + signUserProfileData(response.address, response.privateKey) } } - function signUserProfileData() { - - let privateKey = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(node.payload, 'privateKey') - if (privateKey === undefined || privateKey === "") { return } + function signUserProfileData(address, privateKey) { let request = { url: 'WEB3', @@ -89,6 +84,8 @@ function newGovernanceFunctionLibraryProfileConstructor() { return } UI.projects.foundations.utilities.nodeConfig.saveConfigProperty(node.payload.referenceParent.payload, 'signature', response.signature) + UI.projects.foundations.utilities.nodeConfig.saveConfigProperty(node.payload, 'address', address) + UI.projects.foundations.utilities.nodeConfig.saveConfigProperty(node.payload, 'privateKey', privateKey) node.payload.uiObject.setInfoMessage("Profile Account has been successfully created.") }