Skip to content

Commit

Permalink
Delete non-deterministic grpc client tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hu55a1n1 committed Oct 21, 2024
1 parent e5e8615 commit 45e08bd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 166 deletions.
112 changes: 12 additions & 100 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions crates/utils/cw-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,3 @@ tonic.workspace = true
cosmrs = { workspace = true, default-features = false, features = ["cosmwasm"] }
cosmos-sdk-proto = { workspace = true, default-features = false, features = ["grpc", "grpc-transport"] }
tendermint = { workspace = true, default-features = false }

[dev-dependencies]
tokio.workspace = true
transfers-contract = { path = "../../../examples/transfers/contracts" }
62 changes: 0 additions & 62 deletions crates/utils/cw-client/src/grpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,65 +215,3 @@ pub async fn send_tx(
let tx_response = client.broadcast_tx(request).await?;
Ok(tx_response.into_inner())
}

#[cfg(test)]
mod tests {
use std::error::Error;

use serde_json::json;
use transfers_contract::msg::{execute::Request, QueryMsg::GetRequests};

use crate::{grpc::GrpcClient, CwClient};

#[tokio::test]
#[ignore]
async fn test_query() -> Result<(), Box<dyn Error>> {
let sk = hex::decode("ffc4d3c9119e9e8263de08c0f6e2368ac5c2dacecfeb393f6813da7d178873d2")
.unwrap()
.as_slice()
.try_into()
.unwrap();
let url = "https://grpc-falcron.pion-1.ntrn.tech:80".parse().unwrap();
let contract = "neutron15ruzx9wvrupt9cffzsp6868uad2svhfym2nsgxm2skpeqr3qrd4q4uwk83"
.parse()
.unwrap();

let cw_client = GrpcClient::new(sk, url);
let resp: Vec<Request> = cw_client
.query_smart(&contract, json!(GetRequests {}))
.await?;
println!("{resp:?}");

Ok(())
}

#[tokio::test]
#[ignore]
async fn test_execute() -> Result<(), Box<dyn Error>> {
let sk = hex::decode("ffc4d3c9119e9e8263de08c0f6e2368ac5c2dacecfeb393f6813da7d178873d2")
.unwrap()
.as_slice()
.try_into()
.unwrap();
let url = "https://grpc-falcron.pion-1.ntrn.tech:80".parse().unwrap();
let contract = "neutron15ruzx9wvrupt9cffzsp6868uad2svhfym2nsgxm2skpeqr3qrd4q4uwk83"
.parse()
.unwrap();
let chain_id = "pion-1".parse().unwrap();

let cw_client = GrpcClient::new(sk, url);
let tx_hash = cw_client
.tx_execute(
&contract,
&chain_id,
2000000,
"/* unused since we're getting the account from the sk */",
json!([]),
"11000untrn",
)
.await?;
println!("{}", tx_hash);

Ok(())
}
}

0 comments on commit 45e08bd

Please sign in to comment.