fix: code review

This commit is contained in:
Richard Ramos 2020-09-21 15:19:05 -04:00 committed by Iuri Matias
parent efac44057a
commit 16468960f7
4 changed files with 22 additions and 20 deletions

View File

@ -209,9 +209,8 @@ QtObject:
proc registerENSGasEstimate(self: EnsManager, ensUsername: string, address: string): int {.slot.} = proc registerENSGasEstimate(self: EnsManager, ensUsername: string, address: string): int {.slot.} =
var success: bool var success: bool
let pubKey = status_settings.getSetting[string](Setting.PublicKey, "0x0") let pubKey = status_settings.getSetting[string](Setting.PublicKey, "0x0")
try: result = registerUsernameEstimateGas(ensUsername, address, pubKey, success)
result = registerUsernameEstimateGas(ensUsername, address, pubKey, success) if not success:
except:
result = 380000 result = 380000
proc registerENS*(self: EnsManager, username: string, address: string, gas: string, gasPrice: string, password: string): string {.slot.} = proc registerENS*(self: EnsManager, username: string, address: string, gas: string, gasPrice: string, password: string): string {.slot.} =

View File

@ -45,9 +45,6 @@ ModalPopup {
} }
usernameRegistered(username); usernameRegistered(username);
//% "Transaction sent to the blockchain. You can watch the progress on Etherscan: %2%1"
// sendingSuccess.text = qsTrId("transaction-sent-to-the-blockchain--you-can-watch-the-progress-on-etherscan---2-1").arg(response.result).arg(walletModel.etherscanLink)
// sendingSuccess.open()
} }
TransactionStackView { TransactionStackView {

View File

@ -24,23 +24,29 @@ ModalPopup {
} }
function sendTransaction() { function sendTransaction() {
let responseStr = profileModel.ens.setPubKey(root.ensUsername, try {
selectFromAccount.selectedAccount.address, let responseStr = profileModel.ens.setPubKey(root.ensUsername,
gasSelector.selectedGasLimit, selectFromAccount.selectedAccount.address,
gasSelector.selectedGasPrice, gasSelector.selectedGasLimit,
transactionSigner.enteredPassword) gasSelector.selectedGasPrice,
let response = JSON.parse(responseStr) transactionSigner.enteredPassword)
let response = JSON.parse(responseStr)
if (!response.success) { if (!response.success) {
if (response.error.message.includes("could not decrypt key with given password")){ if (response.error.message.includes("could not decrypt key with given password")){
transactionSigner.validationError = qsTr("Wrong password") transactionSigner.validationError = qsTr("Wrong password")
return return
}
sendingError.text = response.error.message
return sendingError.open()
} }
sendingError.text = response.error.message
usernameUpdated(root.ensUsername);
} catch (e) {
console.error('Error sending the transaction', e)
sendingError.text = "Error sending the transaction: " + e.message;
return sendingError.open() return sendingError.open()
} }
usernameUpdated(root.ensUsername);
} }
TransactionStackView { TransactionStackView {

View File

@ -12,7 +12,7 @@ Popup {
//% "View on Etherscan" //% "View on Etherscan"
readonly property string defaultLinkText: qsTrId("view-on-etherscan") readonly property string defaultLinkText: qsTrId("view-on-etherscan")
property string link: "https://etherscan.io/" property string link: "https://etherscan.io/"
property string linkText: qsTrId("view-on-etherscan") property string linkText: defaultLinkText
id: root id: root
closePolicy: Popup.NoAutoClose closePolicy: Popup.NoAutoClose