From 2143262889f7aaf58f0fc34f1d9fcc8c0c693ce4 Mon Sep 17 00:00:00 2001 From: mrnaveira <47919901+mrnaveira@users.noreply.github.com> Date: Wed, 24 Jul 2024 12:40:26 +0100 Subject: [PATCH] fix list_substates params --- .../src/json_rpc_client.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/clients/tari_indexer_client/src/json_rpc_client.rs b/clients/tari_indexer_client/src/json_rpc_client.rs index 2440e76c7..cbb45170a 100644 --- a/clients/tari_indexer_client/src/json_rpc_client.rs +++ b/clients/tari_indexer_client/src/json_rpc_client.rs @@ -24,6 +24,7 @@ use reqwest::{header, header::HeaderMap, IntoUrl, Url}; use serde::{de::DeserializeOwned, Serialize}; use serde_json as json; use serde_json::json; +use tari_dan_common_types::substate_type::SubstateType; use crate::{ error::IndexerClientError, @@ -87,7 +88,23 @@ impl IndexerJsonRpcClient { &mut self, req: ListSubstatesRequest, ) -> Result { - self.send_request("list_substates", req).await + // Workaround as the indexer JRPC expects templates as strings + #[derive(Serialize)] + struct Params { + pub filter_by_template: Option, + pub filter_by_type: Option, + pub limit: Option, + pub offset: Option, + } + + let params = Params { + filter_by_template: req.filter_by_template.map(|t| t.to_string()), + filter_by_type: req.filter_by_type, + limit: req.limit, + offset: req.offset + }; + + self.send_request("list_substates", params).await } pub async fn submit_transaction(