Skip to content

Commit

Permalink
Fix merge
Browse files Browse the repository at this point in the history
  • Loading branch information
hu55a1n1 committed Nov 6, 2024
1 parent 147da3c commit d727072
Showing 1 changed file with 0 additions and 62 deletions.
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!([]),
"0untrn",
)
.await?;
println!("{}", tx_hash);

Ok(())
}
}

0 comments on commit d727072

Please sign in to comment.