diff --git a/src/snp/grpc.rs b/src/snp/grpc.rs index 9be8310..10fd953 100644 --- a/src/snp/grpc.rs +++ b/src/snp/grpc.rs @@ -157,10 +157,9 @@ pub async fn list_contracts(req: ListVmContractsReq) -> Result, } pub async fn delete_vm(uuid: &str) -> Result<(), Error> { - let mut client = client().await?; + let client = client().await?; let req = DeleteVmReq { uuid: uuid.to_string(), admin_pubkey: Config::get_detee_wallet()? }; - let result = client.delete_vm(sign_request(req)?).await; - match result { + match call_with_follow_redirect!(client, req, delete_vm).await { Ok(confirmation) => { log::debug!("VM deletion confirmation: {confirmation:?}"); } @@ -195,9 +194,8 @@ pub async fn extend_vm(uuid: String, admin_pubkey: String, locked_nano: u64) -> pub async fn update_vm(req: UpdateVmReq) -> Result { info!("Updating VM {req:?}"); - let mut client = client().await?; - let result = client.update_vm(sign_request(req)?).await; - match result { + let client = client().await?; + match call_with_follow_redirect!(client, req, update_vm).await { Ok(resp) => { let resp = resp.into_inner(); if resp.error.is_empty() {