From a11a23f05beb1c1f96fd71668f43669e42802833 Mon Sep 17 00:00:00 2001 From: ii-cruz Date: Wed, 4 Dec 2024 19:47:25 +0000 Subject: [PATCH] Exposes the raw transaction commands via rpc --- .../subcommands/transactions_subcommands.rs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/rpc-client/src/subcommands/transactions_subcommands.rs b/rpc-client/src/subcommands/transactions_subcommands.rs index ee87c3242e..b44c7ceb9c 100644 --- a/rpc-client/src/subcommands/transactions_subcommands.rs +++ b/rpc-client/src/subcommands/transactions_subcommands.rs @@ -328,6 +328,18 @@ pub enum TransactionCommand { #[clap(short, long, default_value_t)] validity_start_height: ValidityStartHeight, }, + + /// Deserializes the given transaction and prints its details. + GetRawTransactionInfo { + /// The transaction to be sent in hex string format. + raw_tx: String, + }, + + /// Sends the given serialized transaction to the network. + SendRawTransaction { + /// The transaction to be sent in hex string format. + raw_tx: String, + }, } impl TransactionCommand { @@ -828,6 +840,14 @@ impl HandleSubcommand for TransactionCommand { .await?; println!("{tx:#?}"); } + TransactionCommand::GetRawTransactionInfo { raw_tx } => { + let tx = client.consensus.get_raw_transaction_info(raw_tx).await?; + println!("{tx:#?}"); + } + TransactionCommand::SendRawTransaction { raw_tx } => { + let tx = client.consensus.send_raw_transaction(raw_tx).await?; + println!("{tx:#?}"); + } } Ok(client) }