fix: rebase gone wrong

This commit is contained in:
Richard Ramos 2020-09-17 17:05:30 -04:00 committed by Iuri Matias
parent 346e98c81a
commit efac44057a
6 changed files with 24 additions and 37 deletions

View File

@ -210,7 +210,7 @@ QtObject:
var success: bool
let pubKey = status_settings.getSetting[string](Setting.PublicKey, "0x0")
try:
result = registerUsernameEstimateGas(ensUsername, address, pubKey)
result = registerUsernameEstimateGas(ensUsername, address, pubKey, success)
except:
result = 380000
@ -219,33 +219,26 @@ QtObject:
let pubKey = status_settings.getSetting[string](Setting.PublicKey, "0x0")
let response = registerUsername(username, pubKey, address, gas, gasPrice, password, success)
result = $(%* { "result": %response, "success": %success })
if success:
self.transactionWasSent(response)
# TODO: handle transaction failure
var ensUsername = formatUsername(username, true)
self.pendingUsernames.incl(ensUsername)
self.add ensUsername
except RpcException as e:
result = $(%* { "error": %* { "message": %e.msg }})
proc setPubKeyGasEstimate(self: EnsManager, ensUsername: string, address: string): int {.slot.} =
var success: bool
let pubKey = status_settings.getSetting[string](Setting.PublicKey, "0x0")
try:
result = setPubKeyEstimateGas(ensUsername, address, pubKey)
except:
result = setPubKeyEstimateGas(ensUsername, address, pubKey, success)
if not success:
result = 80000
proc setPubKey(self: EnsManager, username: string, address: string, gas: string, gasPrice: string, password: string): string {.slot.} =
try:
var success: bool
let pubKey = status_settings.getSetting[string](Setting.PublicKey, "0x0")
let response = setPubKey(username, pubKey, address, gas, gasPrice, password)
result = $(%* { "result": %response })
let response = setPubKey(username, pubKey, address, gas, gasPrice, password, success)
result = $(%* { "result": %response, "success": %success })
if success:
self.transactionWasSent(response)
# TODO: handle transaction failure
self.pendingUsernames.incl(username)
self.add username
except RpcException as e:
result = $(%* { "error": %* { "message": %e.msg }})

View File

@ -190,7 +190,7 @@ proc registerUsername*(username, pubKey, address, gas, gasPrice, password: stri
if success:
trackPendingTransaction(result, address, $sntContract.address, PendingTransactionType.RegisterENS, username & domain)
proc setPubKeyEstimateGas*(username: string, address: string, pubKey: string): int =
proc setPubKeyEstimateGas*(username: string, address: string, pubKey: string, success: var bool): int =
var hash = namehash(username)
hash.removePrefix("0x")
@ -205,12 +205,13 @@ proc setPubKeyEstimateGas*(username: string, address: string, pubKey: string): i
var tx = transactions.buildTokenTransaction(parseAddress(address), parseAddress(resolverAddress), "", "")
try:
let response = resolverContract.methods["setPubkey"].estimateGas(tx, setPubkey)
let response = resolverContract.methods["setPubkey"].estimateGas(tx, setPubkey, success)
if success:
result = fromHex[int](response)
except RpcException as e:
raise
proc setPubKey*(username, pubKey, address, gas, gasPrice, password: string): string =
proc setPubKey*(username, pubKey, address, gas, gasPrice, password: string, success: var bool): string =
var hash = namehash(username)
hash.removePrefix("0x")
@ -225,7 +226,8 @@ proc setPubKey*(username, pubKey, address, gas, gasPrice, password: string): str
var tx = transactions.buildTokenTransaction(parseAddress(address), parseAddress(resolverAddress), gas, gasPrice)
try:
result = resolverContract.methods["setPubkey"].send(tx, setPubkey, password)
result = resolverContract.methods["setPubkey"].send(tx, setPubkey, password, success)
if success:
trackPendingTransaction(result, $address, resolverAddress, PendingTransactionType.SetPubKey, username)
except RpcException as e:
raise

View File

@ -21,16 +21,6 @@ ModalPopup {
icon: StandardIcon.Critical
standardButtons: StandardButton.Ok
}
property MessageDialog sendingSuccess: MessageDialog {
id: sendingSuccess
//% "Success sending the transaction"
title: qsTrId("success-sending-the-transaction")
icon: StandardIcon.NoIcon
standardButtons: StandardButton.Ok
onAccepted: {
root.close()
}
}
onClosed: {
stack.reset()
@ -56,8 +46,8 @@ ModalPopup {
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()
// 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 {

View File

@ -31,7 +31,7 @@ ModalPopup {
transactionSigner.enteredPassword)
let response = JSON.parse(responseStr)
if (response.error) {
if (!response.success) {
if (response.error.message.includes("could not decrypt key with given password")){
transactionSigner.validationError = qsTr("Wrong password")
return

View File

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

1
vendor/nim-confutils vendored Submodule

@ -0,0 +1 @@
Subproject commit 39456fa3d5b637053b616e50a8350b2b932a1d4c