Skip to content

Commit

Permalink
Exposes the raw transaction commands via rpc
Browse files Browse the repository at this point in the history
  • Loading branch information
ii-cruz authored and jsdanielh committed Dec 5, 2024
1 parent 4fa5fb2 commit a11a23f
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions rpc-client/src/subcommands/transactions_subcommands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit a11a23f

Please sign in to comment.