mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-08 08:53:06 +00:00
deploy: 5054ecef35215b0943a422d68b34b1084d04e7a1
This commit is contained in:
parent
bfec3a6d47
commit
9403308cf0
2
.gitignore
vendored
2
.gitignore
vendored
@ -34,3 +34,5 @@ rln
|
||||
package-lock.json
|
||||
node_modules/
|
||||
/.update.timestamp
|
||||
|
||||
libwaku
|
||||
|
||||
@ -259,7 +259,7 @@ procSuite "Waku v2 JSON-RPC API":
|
||||
let client = newRpcHttpClient()
|
||||
await client.connect("127.0.0.1", rpcPort)
|
||||
|
||||
let response = await client.get_waku_v2_store_v1_messages(@[HistoryContentFilter(contentTopic: defaultContentTopic)], some(StorePagingOptions()))
|
||||
let response = await client.get_waku_v2_store_v1_messages(defaultTopic, @[HistoryContentFilter(contentTopic: defaultContentTopic)], some(StorePagingOptions()))
|
||||
check:
|
||||
response.messages.len() == 8
|
||||
response.pagingOptions.isNone
|
||||
|
||||
@ -16,7 +16,7 @@ proc delete_waku_v2_relay_v1_subscriptions(topics: seq[string]): bool
|
||||
|
||||
# Store API
|
||||
|
||||
proc get_waku_v2_store_v1_messages(contentFilters: seq[HistoryContentFilter], pagingOptions: Option[StorePagingOptions]): StoreResponse
|
||||
proc get_waku_v2_store_v1_messages(pubsubTopic: string, contentFilters: seq[HistoryContentFilter], pagingOptions: Option[StorePagingOptions]): StoreResponse
|
||||
|
||||
# Filter API
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ proc installStoreApiHandlers*(node: WakuNode, rpcsrv: RpcServer) =
|
||||
|
||||
## Store API version 1 definitions
|
||||
|
||||
rpcsrv.rpc("get_waku_v2_store_v1_messages") do(contentFilters: seq[HistoryContentFilter], pagingOptions: Option[StorePagingOptions]) -> StoreResponse:
|
||||
rpcsrv.rpc("get_waku_v2_store_v1_messages") do(pubsubTopic: string, contentFilters: seq[HistoryContentFilter], pagingOptions: Option[StorePagingOptions]) -> StoreResponse:
|
||||
## Returns history for a list of content topics with optional paging
|
||||
debug "get_waku_v2_store_v1_messages"
|
||||
|
||||
@ -27,7 +27,8 @@ proc installStoreApiHandlers*(node: WakuNode, rpcsrv: RpcServer) =
|
||||
debug "get_waku_v2_store_v1_messages response"
|
||||
responseFut.complete(response.toStoreResponse())
|
||||
|
||||
let historyQuery = HistoryQuery(contentFilters: contentFilters,
|
||||
let historyQuery = HistoryQuery(pubsubTopic: pubsubTopic,
|
||||
contentFilters: contentFilters,
|
||||
pagingInfo: if pagingOptions.isSome: pagingOptions.get.toPagingInfo() else: PagingInfo())
|
||||
|
||||
await node.query(historyQuery, queryFuncHandler)
|
||||
|
||||
@ -24,13 +24,18 @@ if paramCount() < 1:
|
||||
|
||||
let rpcPort = Port(parseInt(paramStr(1)))
|
||||
|
||||
echo "Please enter your topic:"
|
||||
echo "Please enter your pubsub topic:"
|
||||
let raw_pubsub = readLine(stdin)
|
||||
let pubsubTopic = fmt"{raw_pubsub}"
|
||||
echo "PubSubTopic is:", pubsubTopic
|
||||
|
||||
echo "Please enter your content topic:"
|
||||
let raw_input = readLine(stdin)
|
||||
let input = fmt"{raw_input}"
|
||||
echo "Input is:", input
|
||||
echo "Content topic is:", input
|
||||
|
||||
var node = newRpcHttpClient()
|
||||
waitfor node.connect("localhost", rpcPort)
|
||||
|
||||
var res = waitfor node.get_waku_v2_store_v1_messages(@[HistoryContentFilter(contentTopic: ContentTopic(input))], none(StorePagingOptions))
|
||||
var res = waitfor node.get_waku_v2_store_v1_messages(pubsubTopic, @[HistoryContentFilter(contentTopic: ContentTopic(input))], none(StorePagingOptions))
|
||||
echo "Waku query response: ", res
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user