display main account
This commit is contained in:
parent
aba191841b
commit
8a8e60cd29
2
main.qml
2
main.qml
|
@ -147,7 +147,7 @@ ApplicationWindow {
|
|||
|
||||
RowLayout {
|
||||
Layout.fillHeight: true
|
||||
TextArea { id: accountsResult; Layout.fillWidth: true; text: logic.accountsResult; readOnly: true }
|
||||
TextArea { id: accountResult; Layout.fillWidth: true; text: logic.accountResult; readOnly: true }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ QtObject:
|
|||
discard status.addPeer("enode://2c8de3cbb27a3d30cbb5b3e003bc722b126f5aef82e2052aaef032ca94e0c7ad219e533ba88c70585ebd802de206693255335b100307645ab5170e88620d2a81@47.244.221.14:443")
|
||||
echo status.callPrivateRPC("{\"jsonrpc\":\"2.0\", \"method\":\"wakuext_requestMessages\", \"params\":[{\"topics\": [\"0x7998f3c8\"]}], \"id\": 1}")
|
||||
|
||||
result.accountResult = status.queryAccounts()
|
||||
status.subscribeToTest()
|
||||
|
||||
|
||||
|
@ -59,7 +60,6 @@ QtObject:
|
|||
proc setCallResult(self: ApplicationLogic, callResult: string) {.slot.} =
|
||||
if self.callResult == callResult: return
|
||||
self.callResult = callResult
|
||||
self.accountResult = "0x123"
|
||||
self.callResultChanged(callResult)
|
||||
|
||||
proc `callResult=`*(self: ApplicationLogic, callResult: string) = self.setCallResult(callResult)
|
||||
|
@ -77,14 +77,17 @@ QtObject:
|
|||
# self.setCallResult(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 = "0x123"
|
||||
self.callResultChanged(callResult)
|
||||
self.accountResult = accountResult
|
||||
self.accountResultChanged(accountResult)
|
||||
|
||||
QtProperty[string] accountsResult:
|
||||
QtProperty[string] accountResult:
|
||||
read = accountResult
|
||||
write = setAccountResult
|
||||
notify = callResultChanged
|
||||
|
|
|
@ -14,6 +14,18 @@ proc recreateDir(dirname: string) =
|
|||
proc setSignalHandler*(something: SignalCallback) =
|
||||
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*() =
|
||||
var result = ""
|
||||
|
||||
|
@ -38,7 +50,6 @@ proc subscribeToTest*() =
|
|||
}
|
||||
result = $libstatus.callPrivateRPC($payload)
|
||||
|
||||
|
||||
payload = %* {
|
||||
"jsonrpc": "2.0",
|
||||
"id": 4,
|
||||
|
@ -59,8 +70,6 @@ proc subscribeToTest*() =
|
|||
}
|
||||
result = $libstatus.callPrivateRPC($payload)
|
||||
|
||||
|
||||
|
||||
payload = %* {
|
||||
"jsonrpc": "2.0",
|
||||
"id": 3,
|
||||
|
@ -71,11 +80,6 @@ proc subscribeToTest*() =
|
|||
}
|
||||
result = $libstatus.callPrivateRPC($payload)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
proc setupNewAccount*() =
|
||||
# Deleting directories
|
||||
recreateDir(datadir)
|
||||
|
|
Loading…
Reference in New Issue