2020-10-29 03:07:34 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
|
|
|
import QtGraphicalEffects 1.13
|
|
|
|
import "../imports"
|
2021-04-26 10:25:01 +00:00
|
|
|
import "./status/core"
|
|
|
|
import "./status"
|
2020-10-29 03:07:34 +00:00
|
|
|
|
|
|
|
Item {
|
|
|
|
id: root
|
|
|
|
property bool isPending: false
|
|
|
|
readonly property string uuid: Utils.uuid()
|
2020-10-29 23:08:07 +00:00
|
|
|
property int debounceDelay: 600
|
|
|
|
readonly property var validateAsync: Backpressure.debounce(inpAddress, debounceDelay, function (inputValue) {
|
2020-10-29 03:07:34 +00:00
|
|
|
root.isPending = true
|
|
|
|
var name = inputValue.startsWith("@") ? inputValue.substring(1) : inputValue
|
|
|
|
walletModel.resolveENS(name, uuid)
|
|
|
|
});
|
|
|
|
signal resolved(string resolvedAddress)
|
|
|
|
|
|
|
|
function resolveEns(name) {
|
|
|
|
if (Utils.isValidEns(name)) {
|
|
|
|
root.validateAsync(name)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
width: 12
|
|
|
|
height: 12
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
anchors.fill: parent
|
|
|
|
sourceComponent: loadingIndicator
|
|
|
|
active: root.isPending
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: loadingIndicator
|
2021-04-26 10:25:01 +00:00
|
|
|
StatusLoadingIndicator {
|
2020-10-29 03:07:34 +00:00
|
|
|
width: root.width
|
|
|
|
height: root.height
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: walletModel
|
|
|
|
onEnsWasResolved: {
|
|
|
|
if (uuid !== root.uuid) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
root.isPending = false
|
2020-11-04 12:37:53 +00:00
|
|
|
root.resolved(resolvedAddress)
|
2020-10-29 03:07:34 +00:00
|
|
|
}
|
|
|
|
}
|
2020-11-04 12:37:53 +00:00
|
|
|
}
|