Skip to content

Commit

Permalink
Add historical requests bump for v2.24.2
Browse files Browse the repository at this point in the history
  • Loading branch information
jkilpatr committed Jul 16, 2024
1 parent fa318f0 commit 4372816
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "deep_space"
version = "2.24.1"
version = "2.24.2"
authors = ["Justin Kilpatrick <[email protected]>", "Michał Papierski <[email protected]>"]
repository = "https://github.com/althea-net/deep_space"
description = "A highly portable, batteries included, transaction generation and key management library for CosmosSDK blockchains"
Expand Down
2 changes: 1 addition & 1 deletion src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ mod tests {
#[actix_rt::test]
async fn test_endpoints() {
env_logger::init();
let contact = Contact::new("http://gravitychain.io:9090", TIMEOUT, "gravity").unwrap();
let contact = Contact::new("https://gravitychain.io:9090", TIMEOUT, "gravity").unwrap();

let chain_status = contact.get_chain_status().await.unwrap();
match chain_status {
Expand Down
16 changes: 16 additions & 0 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,22 @@ use std::fmt::Formatter;
use std::fmt::Result as FmtResult;
use std::time::Duration;
use std::{str, usize};
use tonic::metadata::AsciiMetadataValue;
use tonic::{IntoRequest, Request};

/// Converts a standard GRPC query Request struct into a historical one at the given `past_height` by adding
/// the "x-cosmos-block-height" gRPC metadata to the request
/// `req` should be a standard GRPC request like cosmos_sdk_proto_althea::cosmos::bank::v1beta1::QueryBalancesRequest
///
/// Returns a Request with the set gRPC metadata
pub fn historical_grpc_query<T>(req: impl IntoRequest<T>, past_height: u64) -> Request<T> {
let mut request = req.into_request();
request.metadata_mut().insert(
"x-cosmos-block-height",
AsciiMetadataValue::from(past_height),
);
request
}

/// A function that takes a hexadecimal representation of bytes
/// back into a stream of bytes.
Expand Down

0 comments on commit 4372816

Please sign in to comment.