Skip to content

Commit

Permalink
flatten layer of one liner
Browse files Browse the repository at this point in the history
  • Loading branch information
leighmcculloch committed Sep 23, 2024
1 parent 70837be commit bf7f88d
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions cmd/soroban-cli/src/commands/tx/sign.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{
commands::global,
config::{locator, network, sign_with},
xdr::{self, Limits, TransactionEnvelope, WriteXdr},
xdr::{self, Limits, WriteXdr},
};

#[derive(thiserror::Error, Debug)]
Expand Down Expand Up @@ -32,20 +32,17 @@ pub struct Cmd {
impl Cmd {
#[allow(clippy::unused_async)]
pub async fn run(&self, global_args: &global::Args) -> Result<(), Error> {
let txn_env = super::xdr::tx_envelope_from_stdin()?;
let envelope = self.sign_tx_env(txn_env, global_args.quiet).await?;
println!("{}", envelope.to_xdr_base64(Limits::none())?.trim());
Ok(())
}

pub async fn sign_tx_env(
&self,
tx: TransactionEnvelope,
quiet: bool,
) -> Result<TransactionEnvelope, Error> {
Ok(self
let tx_env = super::xdr::tx_envelope_from_stdin()?;
let tx_env_signed = self
.sign_with
.sign_tx_env(tx, &self.locator, &self.network.get(&self.locator)?, quiet)
.await?)
.sign_tx_env(
tx_env,
&self.locator,
&self.network.get(&self.locator)?,
global_args.quiet,
)
.await?;
println!("{}", tx_env_signed.to_xdr_base64(Limits::none())?.trim());
Ok(())
}
}

0 comments on commit bf7f88d

Please sign in to comment.