Merge pull request #6 from status-im/feat/call-private-rpc
feat: Connect to peer and call private RPC
This commit is contained in:
commit
ab84bb8796
|
@ -14,9 +14,12 @@ QtObject:
|
||||||
result.setup()
|
result.setup()
|
||||||
|
|
||||||
status.setupNewAccount()
|
status.setupNewAccount()
|
||||||
|
discard status.addPeer("enode://2c8de3cbb27a3d30cbb5b3e003bc722b126f5aef82e2052aaef032ca94e0c7ad219e533ba88c70585ebd802de206693255335b100307645ab5170e88620d2a81@47.244.221.14:443")
|
||||||
|
echo status.callPrivateRPC("{\"jsonrpc\":\"2.0\", \"method\":\"wakuext_requestMessages\", \"params\":[{\"topics\": [\"0x7998f3c8\"]}], \"id\": 1}")
|
||||||
|
|
||||||
# ¯\_(ツ)_/¯ dunno what is this
|
# ¯\_(ツ)_/¯ dunno what is this
|
||||||
proc setup(self: ApplicationLogic) =
|
proc setup(self: ApplicationLogic) =
|
||||||
|
# discard status.onMessage(self.onMessage)
|
||||||
self.QObject.setup
|
self.QObject.setup
|
||||||
|
|
||||||
# ¯\_(ツ)_/¯ seems to be a method for garbage collection
|
# ¯\_(ツ)_/¯ seems to be a method for garbage collection
|
||||||
|
@ -47,5 +50,9 @@ QtObject:
|
||||||
notify = callResultChanged
|
notify = callResultChanged
|
||||||
|
|
||||||
proc onSend*(self: ApplicationLogic, inputJSON: string) {.slot.} =
|
proc onSend*(self: ApplicationLogic, inputJSON: string) {.slot.} =
|
||||||
self.setCallResult(status.callRPC(inputJSON))
|
self.setCallResult(status.callPrivateRPC(inputJSON))
|
||||||
echo "Done!: ", self.callResult
|
echo "Done!: ", self.callResult
|
||||||
|
|
||||||
|
# proc onMessage*(self: ApplicationLogic, message: string) {.slot.} =
|
||||||
|
# self.setCallResult(message)
|
||||||
|
# echo "Received message: ", message
|
||||||
|
|
|
@ -11,3 +11,9 @@ proc multiAccountStoreDerivedAccounts*(paramsJSON: cstring): cstring {.importc:
|
||||||
proc saveAccountAndLogin*(accountData: cstring, password: cstring, settingsJSON: cstring, configJSON: cstring, subaccountData: cstring): cstring {.importc: "SaveAccountAndLogin".}
|
proc saveAccountAndLogin*(accountData: cstring, password: cstring, settingsJSON: cstring, configJSON: cstring, subaccountData: cstring): cstring {.importc: "SaveAccountAndLogin".}
|
||||||
|
|
||||||
proc callRPC*(inputJSON: cstring): cstring {.importc: "CallRPC".}
|
proc callRPC*(inputJSON: cstring): cstring {.importc: "CallRPC".}
|
||||||
|
|
||||||
|
proc callPrivateRPC*(inputJSON: cstring): cstring {.importc: "CallPrivateRPC".}
|
||||||
|
|
||||||
|
proc addPeer*(peer: cstring): cstring {.importc: "AddPeer".}
|
||||||
|
|
||||||
|
# proc setSignalEventCallback*(callback: proc): void {.importc: "SetSignalEventCallback".}
|
||||||
|
|
|
@ -269,3 +269,12 @@ proc setupNewAccount*() =
|
||||||
|
|
||||||
proc callRPC*(inputJSON: string): string =
|
proc callRPC*(inputJSON: string): string =
|
||||||
return $libstatus.callRPC(inputJSON)
|
return $libstatus.callRPC(inputJSON)
|
||||||
|
|
||||||
|
proc callPrivateRPC*(inputJSON: string): string =
|
||||||
|
return $libstatus.callPrivateRPC(inputJSON)
|
||||||
|
|
||||||
|
proc addPeer*(peer: string): string =
|
||||||
|
return $libstatus.addPeer(peer)
|
||||||
|
|
||||||
|
# proc onMessage*(callback: proc(message: string)): void =
|
||||||
|
# $libstatus.setSignalEventCallback(callback)
|
||||||
|
|
Loading…
Reference in New Issue