Using go-waku

This commit is contained in:
Richard Ramos 2021-04-11 10:45:14 -04:00 committed by Iuri Matias
parent 5bf5095c3c
commit 26c17afb5d
3 changed files with 42 additions and 12 deletions

View File

@ -19,16 +19,26 @@ proc getNodeConfig*(fleetConfig: FleetConfig, installationId: string, networkCon
result = constants.NODE_CONFIG.copy()
result["ClusterConfig"]["Fleet"] = newJString($fleet)
result["ClusterConfig"]["BootNodes"] = %* fleetConfig.getNodes(fleet, FleetNodes.Bootnodes)
result["ClusterConfig"]["TrustedMailServers"] = %* fleetConfig.getNodes(fleet, FleetNodes.Mailservers)
result["ClusterConfig"]["StaticNodes"] = %* fleetConfig.getNodes(fleet, FleetNodes.Whisper)
result["ClusterConfig"]["RendezvousNodes"] = %* fleetConfig.getNodes(fleet, FleetNodes.Rendezvous)
result["Rendezvous"] = newJBool(fleetConfig.getNodes(fleet, FleetNodes.Rendezvous).len > 0)
result["ClusterConfig"]["BootNodes"] = %* (@[])
result["ClusterConfig"]["TrustedMailServers"] = %* (@[])
result["ClusterConfig"]["StaticNodes"] = %* (@[])
result["ClusterConfig"]["RendezvousNodes"] = %* (@[])
result["ClusterConfig"]["WakuNodes"] = %*(@[
"/ip4/134.209.113.86/tcp/9000/p2p/16Uiu2HAmVVi6Q4j7MAKVibquW8aA27UNrA4Q8Wkz9EetGViu8ZF1",
])
result["ClusterConfig"]["WakuStoreNodes"] = %*(@[
"/ip4/134.209.113.86/tcp/9000/p2p/16Uiu2HAmVVi6Q4j7MAKVibquW8aA27UNrA4Q8Wkz9EetGViu8ZF1"
])
result["Rendezvous"] = newJBool(false)
result["NetworkId"] = networkConfig["config"]["NetworkId"]
result["DataDir"] = newDataDir.newJString()
result["UpstreamConfig"]["Enabled"] = networkConfig["config"]["UpstreamConfig"]["Enabled"]
result["UpstreamConfig"]["URL"] = upstreamUrl
result["ShhextConfig"]["InstallationID"] = newJString(installationId)
echo $result
# TODO: commented since it's not necessary (we do the connections thru C bindings). Enable it thru an option once status-nodes are able to be configured in desktop
# result["ListenAddr"] = if existsEnv("STATUS_PORT"): newJString("0.0.0.0:" & $getEnv("STATUS_PORT")) else: newJString("0.0.0.0:30305")
result["WakuConfig"]["BloomFilterMode"] = newJBool(bloomFilterMode)
@ -167,7 +177,7 @@ proc getAccountSettings*(account: GeneratedAccount, defaultNetworks: JsonNode, i
"wallet-root-address": account.derived.walletRoot.address,
"preview-privacy?": true,
"signing-phrase": generateSigningPhrase(3),
"log-level": "INFO",
"log-level": "DEBUG",
"latest-derived-path": 0,
"networks/networks": defaultNetworks,
"currency": "usd",

View File

@ -124,13 +124,13 @@ var NODE_CONFIG* = %* {
#"ListenAddr": ":30304",
"LogEnabled": true,
"LogFile": "geth.log",
"LogLevel": "INFO",
"LogLevel": "DEBUG",
"MailserversConfig": {
"Enabled": true
},
"Name": "StatusDesktop",
"NetworkId": 1,
"NoDiscovery": false,
"NoDiscovery": true,
"PermissionsConfig": {
"Enabled": true
},
@ -160,11 +160,10 @@ var NODE_CONFIG* = %* {
"Enabled": true,
"URL": "https://mainnet.infura.io/v3/" & INFURA_TOKEN_RESOLVED
},
"WakuConfig": {
"BloomFilterMode": nil,
"WakuV2Config": {
"Enabled": true,
"LightClient": true,
"MinimumPoW": 0.001
"Host": "0.0.0.0",
"Port": 0
},
"WalletConfig": {
"Enabled": true

View File

@ -18,6 +18,27 @@ proc delete*(peer: string) =
proc requestAllHistoricMessages*(): string =
return callPrivateRPC("requestAllHistoricMessages".prefix, %*[])
proc requestStoreMessages*(topics: seq[string], symKeyID: string, peer: string, numberOfMessages: int, fromTimestamp: int64 = 0, toTimestamp: int64 = 0, force: bool = false) =
var toValue = times.toUnix(times.getTime())
var fromValue = toValue - 86400
if fromTimestamp != 0:
fromValue = fromTimestamp
if toTimestamp != 0:
toValue = toTimestamp
echo callPrivateRPC("requestMessages".prefix, %* [
{
"topics": topics,
"mailServerPeer": "16Uiu2HAmVVi6Q4j7MAKVibquW8aA27UNrA4Q8Wkz9EetGViu8ZF1",
"timeout": 30,
"limit": numberOfMessages,
"cursor": nil,
"from": fromValue,
"to": toValue,
"force": force
}
])
proc syncChatFromSyncedFrom*(chatId: string): string =
return callPrivateRPC("syncChatFromSyncedFrom".prefix, %*[chatId])