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
|
2021-09-28 15:04:06 +00:00
|
|
|
|
2021-10-26 14:21:08 +00:00
|
|
|
import StatusQ.Components 0.1
|
2024-07-12 09:46:43 +00:00
|
|
|
import StatusQ.Core.Backpressure 0.1
|
|
|
|
|
2021-09-28 15:04:06 +00:00
|
|
|
import utils 1.0
|
2021-12-08 21:20:43 +00:00
|
|
|
import shared.stores 1.0
|
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
|
2021-12-23 20:46:58 +00:00
|
|
|
|
2020-10-29 23:08:07 +00:00
|
|
|
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
|
2022-01-04 12:06:05 +00:00
|
|
|
mainModule.resolveENS(name, uuid)
|
2020-10-29 03:07:34 +00:00
|
|
|
});
|
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
2021-12-23 20:46:58 +00:00
|
|
|
|
|
|
|
Connections {
|
2022-01-04 12:06:05 +00:00
|
|
|
target: mainModule
|
2023-01-18 09:25:36 +00:00
|
|
|
function onResolvedENS(resolvedPubKey: string, resolvedAddress: string, uuid: string) {
|
2021-12-23 20:46:58 +00:00
|
|
|
if (uuid !== root.uuid) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
root.isPending = false
|
|
|
|
root.resolved(resolvedAddress)
|
|
|
|
}
|
|
|
|
}
|
2020-11-04 12:37:53 +00:00
|
|
|
}
|