mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-07 16:33:08 +00:00
Basic RPC client and callsigs to get version
This commit is contained in:
parent
6dd15e3798
commit
b90e358905
3
Makefile
3
Makefile
@ -11,3 +11,6 @@ wakunode: node/v0/wakunode.nim
|
|||||||
|
|
||||||
wakunode2: node/v2/wakunode.nim
|
wakunode2: node/v2/wakunode.nim
|
||||||
nim c --threads:on -o:build/wakunode2 node/v2/wakunode.nim
|
nim c --threads:on -o:build/wakunode2 node/v2/wakunode.nim
|
||||||
|
|
||||||
|
quicksim2: node/v2/quicksim.nim
|
||||||
|
nim c --threads:on -o:build/quicksim2 node/v2/quicksim.nim
|
||||||
|
|||||||
31
node/v2/quicksim.nim
Normal file
31
node/v2/quicksim.nim
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
import
|
||||||
|
os, strformat, chronicles, json_rpc/[rpcclient, rpcserver], nimcrypto/sysrand,
|
||||||
|
eth/common as eth_common, eth/keys,
|
||||||
|
# XXX: Replace me
|
||||||
|
eth/p2p/rlpx_protocols/waku_protocol,
|
||||||
|
../../vendor/nimbus/nimbus/rpc/[hexstrings, rpc_types, waku],
|
||||||
|
rpc/wakurpc,
|
||||||
|
options as what # TODO: Huh? Redefinition?
|
||||||
|
|
||||||
|
from os import DirSep
|
||||||
|
from strutils import rsplit
|
||||||
|
template sourceDir: string = currentSourcePath.rsplit(DirSep, 1)[0]
|
||||||
|
|
||||||
|
const sigWakuPath = &"{sourceDir}{DirSep}rpc{DirSep}wakucallsigs.nim"
|
||||||
|
createRpcSigs(RpcHttpClient, sigWakuPath)
|
||||||
|
|
||||||
|
# More minimal than v0 quicksim, just RPC client for now
|
||||||
|
|
||||||
|
let node1 = newRpcHttpClient()
|
||||||
|
#let node2 = newRpcHttpClient()
|
||||||
|
|
||||||
|
# Where do we connect nodes here? Protocol so not RPC based, maybe?
|
||||||
|
# Could hack it I suppose
|
||||||
|
|
||||||
|
info "Hello there"
|
||||||
|
# Hello world
|
||||||
|
waitFor node1.connect("localhost", Port(8545))
|
||||||
|
|
||||||
|
let version = waitFor node1.wakuVersion()
|
||||||
|
|
||||||
|
info "Version is", version
|
||||||
29
node/v2/rpc/wakucallsigs.nim
Normal file
29
node/v2/rpc/wakucallsigs.nim
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# NOTE: Taken from v0, only version exists right now
|
||||||
|
proc waku_version(): string
|
||||||
|
|
||||||
|
proc waku_info(): WhisperInfo
|
||||||
|
proc waku_setMaxMessageSize(size: uint64): bool
|
||||||
|
proc waku_setMinPoW(pow: float): bool
|
||||||
|
proc waku_markTrustedPeer(enode: string): bool
|
||||||
|
|
||||||
|
proc waku_newKeyPair(): Identifier
|
||||||
|
proc waku_addPrivateKey(key: string): Identifier
|
||||||
|
proc waku_deleteKeyPair(id: Identifier): bool
|
||||||
|
proc waku_hasKeyPair(id: Identifier): bool
|
||||||
|
proc waku_getPublicKey(id: Identifier): PublicKey
|
||||||
|
proc waku_getPrivateKey(id: Identifier): PrivateKey
|
||||||
|
|
||||||
|
proc waku_newSymKey(): Identifier
|
||||||
|
proc waku_addSymKey(key: string): Identifier
|
||||||
|
proc waku_generateSymKeyFromPassword(password: string): Identifier
|
||||||
|
proc waku_hasSymKey(id: Identifier): bool
|
||||||
|
proc waku_getSymKey(id: Identifier): SymKey
|
||||||
|
proc waku_deleteSymKey(id: Identifier): bool
|
||||||
|
|
||||||
|
proc waku_newMessageFilter(options: WhisperFilterOptions): Identifier
|
||||||
|
proc waku_deleteMessageFilter(id: Identifier): bool
|
||||||
|
proc waku_getFilterMessages(id: Identifier): seq[WhisperFilterMessage]
|
||||||
|
proc waku_post(message: WhisperPostMessage): bool
|
||||||
|
|
||||||
|
proc wakusim_generateTraffic(amount: int): bool
|
||||||
|
proc wakusim_generateRandomTraffic(amount: int): bool
|
||||||
Loading…
x
Reference in New Issue
Block a user