commit
23139cc9a5
10
main.qml
10
main.qml
|
@ -21,6 +21,7 @@ ApplicationWindow {
|
||||||
id: tabBar
|
id: tabBar
|
||||||
width: 50
|
width: 50
|
||||||
height: width *2 + spacing
|
height: width *2 + spacing
|
||||||
|
currentIndex: 0
|
||||||
transformOrigin: Item.Top
|
transformOrigin: Item.Top
|
||||||
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
@ -141,9 +142,14 @@ ApplicationWindow {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
ColumnLayout {
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
}
|
RowLayout {
|
||||||
|
Layout.fillHeight: true
|
||||||
|
TextArea { id: accountResult; Layout.fillWidth: true; text: logic.accountResult; readOnly: true }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ QtObject:
|
||||||
type ApplicationLogic* = ref object of QObject
|
type ApplicationLogic* = ref object of QObject
|
||||||
app: QApplication
|
app: QApplication
|
||||||
callResult: string
|
callResult: string
|
||||||
|
accountResult: string
|
||||||
|
|
||||||
# Constructor
|
# Constructor
|
||||||
proc newApplicationLogic*(app: QApplication): ApplicationLogic =
|
proc newApplicationLogic*(app: QApplication): ApplicationLogic =
|
||||||
|
@ -31,6 +32,7 @@ QtObject:
|
||||||
discard status.addPeer("enode://2c8de3cbb27a3d30cbb5b3e003bc722b126f5aef82e2052aaef032ca94e0c7ad219e533ba88c70585ebd802de206693255335b100307645ab5170e88620d2a81@47.244.221.14:443")
|
discard status.addPeer("enode://2c8de3cbb27a3d30cbb5b3e003bc722b126f5aef82e2052aaef032ca94e0c7ad219e533ba88c70585ebd802de206693255335b100307645ab5170e88620d2a81@47.244.221.14:443")
|
||||||
echo status.callPrivateRPC("{\"jsonrpc\":\"2.0\", \"method\":\"wakuext_requestMessages\", \"params\":[{\"topics\": [\"0x7998f3c8\"]}], \"id\": 1}")
|
echo status.callPrivateRPC("{\"jsonrpc\":\"2.0\", \"method\":\"wakuext_requestMessages\", \"params\":[{\"topics\": [\"0x7998f3c8\"]}], \"id\": 1}")
|
||||||
|
|
||||||
|
result.accountResult = status.queryAccounts()
|
||||||
status.subscribeToTest()
|
status.subscribeToTest()
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,3 +76,18 @@ QtObject:
|
||||||
# proc onMessage*(self: ApplicationLogic, message: string) {.slot.} =
|
# proc onMessage*(self: ApplicationLogic, message: string) {.slot.} =
|
||||||
# self.setCallResult(message)
|
# self.setCallResult(message)
|
||||||
# echo "Received message: ", message
|
# echo "Received message: ", message
|
||||||
|
|
||||||
|
proc accountResultChanged*(self: ApplicationLogic, callResult: string) {.signal.}
|
||||||
|
|
||||||
|
proc accountResult*(self: ApplicationLogic): string {.slot.} =
|
||||||
|
result = self.accountResult
|
||||||
|
|
||||||
|
proc setAccountResult(self: ApplicationLogic, accountResult: string) {.slot.} =
|
||||||
|
if self.accountResult == accountResult: return
|
||||||
|
self.accountResult = accountResult
|
||||||
|
self.accountResultChanged(accountResult)
|
||||||
|
|
||||||
|
QtProperty[string] accountResult:
|
||||||
|
read = accountResult
|
||||||
|
write = setAccountResult
|
||||||
|
notify = callResultChanged
|
||||||
|
|
|
@ -14,6 +14,18 @@ proc recreateDir(dirname: string) =
|
||||||
proc setSignalHandler*(something: SignalCallback) =
|
proc setSignalHandler*(something: SignalCallback) =
|
||||||
libstatus.setSignalEventCallback(something)
|
libstatus.setSignalEventCallback(something)
|
||||||
|
|
||||||
|
proc queryAccounts*(): string =
|
||||||
|
var payload = %* {
|
||||||
|
"jsonrpc": "2.0",
|
||||||
|
"method": "eth_accounts",
|
||||||
|
"params": [
|
||||||
|
[]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
var response = $libstatus.callPrivateRPC($payload)
|
||||||
|
echo response
|
||||||
|
result = parseJson(response)["result"][0].getStr()
|
||||||
|
|
||||||
proc subscribeToTest*() =
|
proc subscribeToTest*() =
|
||||||
var result = ""
|
var result = ""
|
||||||
|
|
||||||
|
@ -38,7 +50,6 @@ proc subscribeToTest*() =
|
||||||
}
|
}
|
||||||
result = $libstatus.callPrivateRPC($payload)
|
result = $libstatus.callPrivateRPC($payload)
|
||||||
|
|
||||||
|
|
||||||
payload = %* {
|
payload = %* {
|
||||||
"jsonrpc": "2.0",
|
"jsonrpc": "2.0",
|
||||||
"id": 4,
|
"id": 4,
|
||||||
|
@ -59,8 +70,6 @@ proc subscribeToTest*() =
|
||||||
}
|
}
|
||||||
result = $libstatus.callPrivateRPC($payload)
|
result = $libstatus.callPrivateRPC($payload)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
payload = %* {
|
payload = %* {
|
||||||
"jsonrpc": "2.0",
|
"jsonrpc": "2.0",
|
||||||
"id": 3,
|
"id": 3,
|
||||||
|
@ -71,11 +80,6 @@ proc subscribeToTest*() =
|
||||||
}
|
}
|
||||||
result = $libstatus.callPrivateRPC($payload)
|
result = $libstatus.callPrivateRPC($payload)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
proc setupNewAccount*() =
|
proc setupNewAccount*() =
|
||||||
# Deleting directories
|
# Deleting directories
|
||||||
recreateDir(datadir)
|
recreateDir(datadir)
|
||||||
|
|
Loading…
Reference in New Issue