mirror of
https://github.com/status-im/status-lib.git
synced 2025-01-29 21:55:49 +00:00
refactor: mailserver and general rpc calls added
This commit is contained in:
parent
2be8bb55ee
commit
40ad92f533
@ -1,5 +1,5 @@
|
||||
import json, strutils, json_serialization, chronicles
|
||||
import core
|
||||
import core, utils
|
||||
import response_type
|
||||
|
||||
import status_go
|
||||
@ -16,4 +16,28 @@ proc validateMnemonic*(mnemonic: string): RpcResponse[JsonNode] {.raises: [Excep
|
||||
|
||||
except RpcException as e:
|
||||
error "error doing rpc request", methodName = "validateMnemonic", exception=e.msg
|
||||
raise newException(RpcException, e.msg)
|
||||
raise newException(RpcException, e.msg)
|
||||
|
||||
proc generateSymKeyFromPassword*(password: string): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||
let payload = %* [password]
|
||||
result = core.callPrivateRPC("waku_generateSymKeyFromPassword", payload)
|
||||
|
||||
proc adminPeers*(): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||
let payload = %* []
|
||||
result = core.callPrivateRPC("admin_peers", payload)
|
||||
|
||||
proc wakuV2Peers*(): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||
let payload = %* []
|
||||
result = core.callPrivateRPC("peers".prefix, payload)
|
||||
|
||||
proc dialPeer*(address: string): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||
let payload = %* [address]
|
||||
result = core.callPrivateRPC("dialPeer".prefix, payload)
|
||||
|
||||
proc dropPeerByID*(peer: string): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||
let payload = %* [peer]
|
||||
result = core.callPrivateRPC("dropPeer".prefix, payload)
|
||||
|
||||
proc removePeer*(peer: string): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||
let payload = %* [peer]
|
||||
result = core.callPrivateRPC("admin_removePeer", payload)
|
@ -12,7 +12,7 @@ proc saveMailserver*(id: string, name: string, enode: string, fleet: string):
|
||||
"address": enode,
|
||||
"fleet": fleet
|
||||
}]
|
||||
result = callPrivateRPC("mailservers_addMailserver", payload)
|
||||
result = core.callPrivateRPC("mailservers_addMailserver", payload)
|
||||
|
||||
proc getMailservers*(): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||
result = callPrivateRPC("mailservers_getMailservers")
|
||||
result = core.callPrivateRPC("mailservers_getMailservers")
|
Loading…
x
Reference in New Issue
Block a user