Add --show-transactions flag to `bigtable transaction-history` command
This commit is contained in:
parent
4013447c08
commit
2665c5b3c2
|
@ -133,6 +133,7 @@ pub async fn transaction_history(
|
||||||
mut before: Option<Signature>,
|
mut before: Option<Signature>,
|
||||||
until: Option<Signature>,
|
until: Option<Signature>,
|
||||||
verbose: bool,
|
verbose: bool,
|
||||||
|
show_transactions: bool,
|
||||||
) -> Result<(), Box<dyn std::error::Error>> {
|
) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let bigtable = solana_storage_bigtable::LedgerStorage::new(true).await?;
|
let bigtable = solana_storage_bigtable::LedgerStorage::new(true).await?;
|
||||||
|
|
||||||
|
@ -168,6 +169,28 @@ pub async fn transaction_history(
|
||||||
} else {
|
} else {
|
||||||
println!("{}", result.signature);
|
println!("{}", result.signature);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if show_transactions {
|
||||||
|
match bigtable
|
||||||
|
.get_confirmed_transaction(&result.signature, UiTransactionEncoding::Base64)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
Ok(Some(confirmed_transaction)) => {
|
||||||
|
println_transaction(
|
||||||
|
&confirmed_transaction
|
||||||
|
.transaction
|
||||||
|
.transaction
|
||||||
|
.decode()
|
||||||
|
.expect("Successful decode"),
|
||||||
|
&confirmed_transaction.transaction.meta,
|
||||||
|
" ",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Ok(None) => println!(" Confirmed transaction details not available"),
|
||||||
|
Err(err) => println!(" Unable to get confirmed transaction details: {}", err),
|
||||||
|
}
|
||||||
|
println!();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -314,6 +337,12 @@ impl BigTableSubCommand for App<'_, '_> {
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.help("End with the last signature newer than this one"),
|
.help("End with the last signature newer than this one"),
|
||||||
)
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("show_transactions")
|
||||||
|
.long("show-transactions")
|
||||||
|
.takes_value(false)
|
||||||
|
.help("Display the full transactions"),
|
||||||
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("verbose")
|
Arg::with_name("verbose")
|
||||||
.short("v")
|
.short("v")
|
||||||
|
@ -375,8 +404,16 @@ pub fn bigtable_process_command(ledger_path: &Path, matches: &ArgMatches<'_>) {
|
||||||
.value_of("until")
|
.value_of("until")
|
||||||
.map(|signature| signature.parse().expect("Invalid signature"));
|
.map(|signature| signature.parse().expect("Invalid signature"));
|
||||||
let verbose = arg_matches.is_present("verbose");
|
let verbose = arg_matches.is_present("verbose");
|
||||||
|
let show_transactions = arg_matches.is_present("show_transactions");
|
||||||
|
|
||||||
runtime.block_on(transaction_history(&address, limit, before, until, verbose))
|
runtime.block_on(transaction_history(
|
||||||
|
&address,
|
||||||
|
limit,
|
||||||
|
before,
|
||||||
|
until,
|
||||||
|
verbose,
|
||||||
|
show_transactions,
|
||||||
|
))
|
||||||
}
|
}
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue