try grpc
This commit is contained in:
parent
f4bc1758da
commit
7379ec91c3
2 changed files with 13 additions and 6 deletions
|
@ -23,3 +23,5 @@ mc-attestation-verifier.workspace = true
|
|||
p256.workspace = true
|
||||
x509-cert = "0.2.5"
|
||||
der.workspace = true
|
||||
anyhow.workspace = true
|
||||
hex.workspace = true
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use cw_client::{CliClient, CwClient};
|
||||
use cw_client::{GrpcClient, CwClient};
|
||||
use quartz_tcbinfo_msgs::{QueryMsg, ExecuteMsg};
|
||||
use quoted_string::strip_dquotes;
|
||||
use anyhow::{anyhow, Result};
|
||||
use quoted_string::test_utils::TestSpec;
|
||||
use quoted_string::to_content;
|
||||
use reqwest::Url;
|
||||
|
@ -41,11 +42,14 @@ async fn get_fmspc_list() -> Vec<Fmspc> {
|
|||
fmspc_list
|
||||
}
|
||||
|
||||
async fn upsert_tcbinfo(url: &str, contract_addr: &str, chain_id : Id, sender: &str, gas: u64, fees: &str) -> Result<(), &'static str> {
|
||||
async fn upsert_tcbinfo(url: &str, contract_addr: &str, chain_id : Id, sender: &str, gas: u64, fees: &str, sk: &str) -> Result<(), &'static str> {
|
||||
|
||||
let testnet = Url::parse(url).expect("couldn't parse network URL");
|
||||
|
||||
let client = CliClient::neutrond(testnet);
|
||||
let network = Url::parse(url).expect("couldn't parse network URL");
|
||||
let skey = hex::decode(sk).expect("couldn't read signing key")
|
||||
.as_slice()
|
||||
.try_into()
|
||||
.map_err(|e| anyhow!("failed to read/parse sk: {}", e)).expect("couldn't extract result value");
|
||||
let client = GrpcClient::new(skey, network);
|
||||
let fmspc_list = get_fmspc_list().await;
|
||||
|
||||
for fmspc in fmspc_list {
|
||||
|
@ -104,7 +108,8 @@ pub async fn main() {
|
|||
let sender: &str = &args[4];
|
||||
let gas: &u64 = &args[5].parse().expect("gas must be a u64 value");
|
||||
let fees: &str = &args[6];
|
||||
upsert_tcbinfo(url, contract_address, Id::try_from(chain_id.clone()).expect("invalid chain id"), sender, *gas, fees).await.expect("TCBInfo update failed");
|
||||
let sk: &str = &args[7];
|
||||
upsert_tcbinfo(url, contract_address, Id::try_from(chain_id.clone()).expect("invalid chain id"), sender, *gas, fees, sk).await.expect("TCBInfo update failed");
|
||||
}
|
||||
|
||||
/*let url =;
|
||||
|
|
Loading…
Reference in a new issue