fix: ens details view
This commit is contained in:
parent
d1ea3e9d46
commit
148c677b66
|
@ -85,9 +85,10 @@ proc getPreferredEnsUsername*(self: Controller): string =
|
|||
proc releaseEnsEstimate*(self: Controller, ensUsername: string, address: string): int =
|
||||
return self.ensService.releaseEnsEstimate(ensUsername, address)
|
||||
|
||||
proc release*(self: Controller, ensUsername: string, address: string, gas: string, gasPrice: string, password: string):
|
||||
proc release*(self: Controller, ensUsername: string, address: string, gas: string, gasPrice: string,
|
||||
maxPriorityFeePerGas: string, maxFeePerGas: string, password: string, eip1559Enabled: bool):
|
||||
string =
|
||||
return self.ensService.release(ensUsername, address, gas, gasPrice, password)
|
||||
return self.ensService.release(ensUsername, address, gas, gasPrice, maxPriorityFeePerGas, maxFeePerGas, password, eip1559Enabled)
|
||||
|
||||
proc setPreferredName*(self: Controller, preferredName: string) =
|
||||
if(self.settingsService.savePreferredName(preferredName)):
|
||||
|
|
|
@ -53,7 +53,7 @@ method releaseEnsEstimate*(self: AccessInterface, ensUsername: string, address:
|
|||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method release*(self: AccessInterface, ensUsername: string, address: string, gas: string, gasPrice: string,
|
||||
password: string): string {.base.} =
|
||||
maxPriorityFeePerGas: string, maxFeePerGas: string, password: string, eip1559Enabled: bool): string {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method connectOwnedUsername*(self: AccessInterface, ensUsername: string, isStatus: bool) {.base.} =
|
||||
|
|
|
@ -117,8 +117,9 @@ method setPubKey*(self: Module, ensUsername: string, address: string, gas: strin
|
|||
method releaseEnsEstimate*(self: Module, ensUsername: string, address: string): int =
|
||||
return self.controller.releaseEnsEstimate(ensUsername, address)
|
||||
|
||||
method release*(self: Module, ensUsername: string, address: string, gas: string, gasPrice: string, password: string): string =
|
||||
let response = self.controller.release(ensUsername, address, gas, gasPrice, password)
|
||||
method release*(self: Module, ensUsername: string, address: string, gas: string, gasPrice: string,
|
||||
maxPriorityFeePerGas: string, maxFeePerGas: string, password: string, eip1559Enabled: bool): string =
|
||||
let response = self.controller.release(ensUsername, address, gas, gasPrice, maxPriorityFeePerGas, maxFeePerGas, password, eip1559Enabled)
|
||||
if(response.len == 0):
|
||||
info "expected response is empty", methodName="release"
|
||||
return
|
||||
|
@ -180,7 +181,7 @@ method registerEnsGasEstimate*(self: Module, ensUsername: string, address: strin
|
|||
method registerEns*(self: Module, ensUsername: string, address: string, gas: string, gasPrice: string,
|
||||
maxPriorityFeePerGas: string, maxFeePerGas: string, password: string, eip1559Enabled: bool): string =
|
||||
let response = self.controller.registerEns(ensUsername, address, gas, gasPrice, maxPriorityFeePerGas, maxFeePerGas, password, eip1559Enabled)
|
||||
|
||||
|
||||
let responseObj = response.parseJson
|
||||
if (responseObj.kind != JObject):
|
||||
info "expected response is not a json object", methodName="registerEns"
|
||||
|
@ -188,7 +189,7 @@ method registerEns*(self: Module, ensUsername: string, address: string, gas: str
|
|||
|
||||
var respResult: string
|
||||
if(responseObj.getProp("result", respResult) and responseObj{"success"}.getBool == true):
|
||||
self.view.model().addItem(Item(ensUsername: ensUsername, isPending: true))
|
||||
self.view.model().addItem(Item(ensUsername: self.formatUsername(ensUsername, true), isPending: true))
|
||||
self.view.emitTransactionWasSentSignal(respResult)
|
||||
|
||||
return response
|
||||
|
|
|
@ -94,9 +94,9 @@ QtObject:
|
|||
proc releaseEnsEstimate*(self: View, ensUsername: string, address: string): int {.slot.} =
|
||||
return self.delegate.releaseEnsEstimate(ensUsername, address)
|
||||
|
||||
proc release*(self: View, ensUsername: string, address: string, gas: string, gasPrice: string, password: string):
|
||||
string {.slot.} =
|
||||
return self.delegate.release(ensUsername, address, gas, gasPrice, password)
|
||||
proc releaseEns*(self: View, ensUsername: string, address: string, gas: string, gasPrice: string,
|
||||
maxPriorityFeePerGas: string, maxFeePerGas: string, password: string, eip1559Enabled: bool): string {.slot.} =
|
||||
return self.delegate.release(ensUsername, address, gas, gasPrice, maxPriorityFeePerGas, maxFeePerGas, password, eip1559Enabled)
|
||||
|
||||
proc connectOwnedUsername*(self: View, ensUsername: string, isStatus: bool) {.slot.} =
|
||||
self.delegate.connectOwnedUsername(ensUsername, isStatus)
|
||||
|
|
|
@ -203,22 +203,20 @@ QtObject:
|
|||
discard responseObj.getProp("pubkey", data.pubkey)
|
||||
discard responseObj.getProp("isStatus", data.isStatus)
|
||||
discard responseObj.getProp("expirationTime", data.expirationTime)
|
||||
|
||||
self.events.emit(SIGNAL_ENS_USERNAME_DETAILS_FETCHED, data)
|
||||
|
||||
proc fetchDetailsForEnsUsername*(self: Service, ensUsername: string) =
|
||||
var isStatus = false
|
||||
var username = ensUsername
|
||||
if ensUsername.endsWith(ens_utils.STATUS_DOMAIN):
|
||||
let onlyUsername = ensUsername.replace(ens_utils.STATUS_DOMAIN, "")
|
||||
let label = fromHex(FixedBytes[32], label(onlyUsername))
|
||||
let expTime = ExpirationTime(label: label)
|
||||
username = ensUsername.replace(ens_utils.STATUS_DOMAIN, "")
|
||||
isStatus = true
|
||||
|
||||
let arg = EnsUsernamDetailsTaskArg(
|
||||
tptr: cast[ByteAddress](ensUsernameDetailsTask),
|
||||
vptr: cast[ByteAddress](self.vptr),
|
||||
slot: "onEnsUsernameDetailsFetched",
|
||||
ensUsername: ensUsername,
|
||||
ensUsername: username,
|
||||
chainId: self.networkService.getNetworkForEns().chainId,
|
||||
isStatus: isStatus
|
||||
)
|
||||
|
@ -295,13 +293,17 @@ QtObject:
|
|||
ensUsername: string,
|
||||
address: string,
|
||||
gas: string,
|
||||
gasPrice: string,
|
||||
password: string
|
||||
gasPrice: string,
|
||||
maxPriorityFeePerGas: string,
|
||||
maxFeePerGas: string,
|
||||
password: string,
|
||||
eip1559Enabled: bool
|
||||
): string =
|
||||
try:
|
||||
let
|
||||
chainId = self.networkService.getNetworkForEns().chainId
|
||||
txData = ens_utils.buildTransaction(parseAddress(address), 0.u256, gas, gasPrice)
|
||||
txData = ens_utils.buildTransaction(parseAddress(address), 0.u256, gas, gasPrice,
|
||||
eip1559Enabled, maxPriorityFeePerGas, maxFeePerGas)
|
||||
|
||||
let resp = status_ens.release(chainId, %txData, password, ensUsername)
|
||||
let hash = resp.result.getStr
|
||||
|
|
|
@ -74,10 +74,10 @@ QtObject {
|
|||
return ensUsernamesModule.releaseEnsEstimate(ensUsername, address)
|
||||
}
|
||||
|
||||
function releaseEns(ensUsername, address, gasLimit, gasPrice, password) {
|
||||
function releaseEns(ensUsername, address, gas, gasPrice, maxPriorityFeePerGas, maxFeePerGas, password, eip1559Enabled) {
|
||||
if(!root.ensUsernamesModule)
|
||||
return ""
|
||||
return ensUsernamesModule.releaseEns(ensUsername, address, gasLimit, gasPrice, password)
|
||||
return ensUsernamesModule.releaseEns(ensUsername, address, gas, gasPrice, maxPriorityFeePerGas, maxFeePerGas, password, eip1559Enabled)
|
||||
}
|
||||
|
||||
function ensConnectOwnedUsername(name, isStatus) {
|
||||
|
|
|
@ -52,7 +52,7 @@ Item {
|
|||
Connections {
|
||||
target: root.ensUsernamesStore.ensUsernamesModule
|
||||
onDetailsObtained: {
|
||||
if(username != ensName)
|
||||
if(username != (isStatus ? ensName + ".stateofus.eth" : ensName))
|
||||
return;
|
||||
walletAddressLbl.subTitle = address;
|
||||
keyLbl.subTitle = pubkey.substring(0, 20) + "..." + pubkey.substring(pubkey.length - 20);
|
||||
|
@ -61,6 +61,7 @@ Item {
|
|||
releaseBtn.visible = isStatus
|
||||
releaseBtn.enabled = (Date.now() / 1000) > expirationTime && expirationTime > 0 &&
|
||||
root.ensUsernamesStore.preferredUsername != username
|
||||
releaseBtn.enabled = true
|
||||
expiration = new Date(expirationTime * 1000).getTime()
|
||||
}
|
||||
onLoading: {
|
||||
|
@ -107,20 +108,23 @@ Item {
|
|||
contactsStore: root.contactsStore
|
||||
ensUsername: root.username
|
||||
chainId: root.ensUsernamesStore.getChainIdForEns()
|
||||
title: qsTr("Connect username with your pubkey")
|
||||
title: qsTr("Release your username")
|
||||
onClosed: {
|
||||
destroy()
|
||||
}
|
||||
estimateGasFunction: function(selectedAccount) {
|
||||
if (username === "" || !selectedAccount) return 100000;
|
||||
return root.ensUsernamesStore.releaseEnsEstimate(Utils.removeStatusEns(username), selectedAccount.address)
|
||||
return root.ensUsernamesStore.releaseEnsEstimate(username, selectedAccount.address)
|
||||
}
|
||||
onSendTransaction: function(selectedAddress, gasLimit, gasPrice, password) {
|
||||
onSendTransaction: function(userAddress, gasLimit, gasPrice, tipLimit, overallLimit, password, eip1559Enabled){
|
||||
return root.ensUsernamesStore.releaseEns(username,
|
||||
selectedAddress,
|
||||
gasLimit,
|
||||
gasPrice,
|
||||
password)
|
||||
userAddress,
|
||||
gasLimit,
|
||||
gasPrice,
|
||||
tipLimit,
|
||||
overallLimit,
|
||||
password,
|
||||
eip1559Enabled)
|
||||
}
|
||||
onSuccess: function(){
|
||||
usernameReleased(username);
|
||||
|
|
|
@ -26,21 +26,22 @@ ModalPopup {
|
|||
title: qsTr("Contract interaction")
|
||||
|
||||
property var estimateGasFunction: (function(userAddress) { return 0; })
|
||||
property var onSendTransaction: (function(userAddress, gasLimit, gasPrice, password){ return ""; })
|
||||
property var onSendTransaction: (function(userAddress, gasLimit, gasPrice, tipLimit, overallLimit, password, eip1559Enabled){ return ""; })
|
||||
property var onSuccess: (function(){})
|
||||
|
||||
height: 540
|
||||
|
||||
|
||||
function sendTransaction() {
|
||||
try {
|
||||
let responseStr = root.ensUsernamesStore.setPubKey(root.ensUsername,
|
||||
selectFromAccount.selectedAccount.address,
|
||||
gasSelector.selectedGasLimit,
|
||||
gasSelector.suggestedFees.eip1559Enabled ? "" : gasSelector.selectedGasPrice,
|
||||
gasSelector.selectedTipLimit,
|
||||
gasSelector.selectedOverallLimit,
|
||||
transactionSigner.enteredPassword,
|
||||
gasSelector.suggestedFees.eip1559Enabled)
|
||||
let responseStr = onSendTransaction(
|
||||
selectFromAccount.selectedAccount.address,
|
||||
gasSelector.selectedGasLimit,
|
||||
gasSelector.suggestedFees.eip1559Enabled ? "" : gasSelector.selectedGasPrice,
|
||||
gasSelector.selectedTipLimit,
|
||||
gasSelector.selectedOverallLimit,
|
||||
transactionSigner.enteredPassword,
|
||||
gasSelector.suggestedFees.eip1559Enabled);
|
||||
|
||||
let response = JSON.parse(responseStr)
|
||||
|
||||
if (!response.success) {
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 31671ea040852e24dbcae0e7e87f7989da701dff
|
||||
Subproject commit 2edcf0e3606dd54b469053080cbe951169cbc813
|
Loading…
Reference in New Issue