From e6dca938e8d67422c9eee0b4213bafb9ae4298bd Mon Sep 17 00:00:00 2001 From: Darun Seethammagari Date: Mon, 20 May 2024 17:37:44 -0700 Subject: [PATCH] Update function return types --- block-streamer/examples/get_bitmaps.rs | 19 ++++++++++++------- block-streamer/src/graphql.rs | 16 ++++++++-------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/block-streamer/examples/get_bitmaps.rs b/block-streamer/examples/get_bitmaps.rs index 1a9ba0302..7d2dd10fb 100644 --- a/block-streamer/examples/get_bitmaps.rs +++ b/block-streamer/examples/get_bitmaps.rs @@ -8,20 +8,25 @@ async fn main() -> Result<(), Box> { let client = graphql::GraphqlClient::new( "https://queryapi-hasura-graphql-mainnet-vcqilefdcq-ew.a.run.app/v1/graphql".to_string(), ); - let _ = client - .get_bitmaps_wildcard( - "app.nearcrowd.near".to_string(), + + let exact_query = client + .get_bitmaps_exact( + vec!["app.nearcrowd.near".to_owned()], "2024-03-21".to_string(), 100, 0, ) .await; - client - .get_bitmaps_exact( - vec!["app.nearcrowd.near".to_owned()], + println!("exact query: {:#?}", exact_query); + + let wildcard_query = client + .get_bitmaps_wildcard( + "app.nearcrowd.near".to_string(), "2024-03-21".to_string(), 100, 0, ) - .await + .await; + println!("wildcard query: {:#?}", wildcard_query); + Ok(()) } diff --git a/block-streamer/src/graphql.rs b/block-streamer/src/graphql.rs index c6657d7aa..36981a48b 100644 --- a/block-streamer/src/graphql.rs +++ b/block-streamer/src/graphql.rs @@ -26,7 +26,7 @@ impl GraphqlClient { block_date: String, limit: i64, offset: i64, - ) -> Result<(), Box> { + ) -> Result, Box> { let variables = get_bitmaps_exact::Variables { receiver_ids: Some(receiver_ids), block_date: Some(block_date), @@ -40,10 +40,10 @@ impl GraphqlClient { .header("x-hasura-role", HASURA_ACCOUNT) .json(&request_body) .send() - .await?; + .await + .expect("Failed to query bitmaps for list of exact receivers"); let response_body: Response = res.json().await?; - println!("{:#?}", response_body); - Ok(()) + Ok(response_body) } pub async fn get_bitmaps_wildcard( @@ -52,7 +52,7 @@ impl GraphqlClient { block_date: String, limit: i64, offset: i64, - ) -> Result<(), Box> { + ) -> Result, Box> { let variables = get_bitmaps_wildcard::Variables { receiver_ids: Some(receiver_ids), block_date: Some(block_date), @@ -66,10 +66,10 @@ impl GraphqlClient { .header("x-hasura-role", HASURA_ACCOUNT) .json(&request_body) .send() - .await?; + .await + .expect("Failed to query bitmaps for wildcard receivers"); let response_body: Response = res.json().await?; - println!("{:#?}", response_body); - Ok(()) + Ok(response_body) } }