Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: displaying transaction fee #333

Merged
merged 19 commits into from
May 7, 2024
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1142,14 +1142,31 @@ pub fn print_transaction_status(
network_config: &crate::config::NetworkConfig,
) -> crate::CliResult {
eprintln!("--- Logs ---------------------------");

let mut total_gas_burnt = 0;
let mut total_tokens_burnt = 0;
frolvanya marked this conversation as resolved.
Show resolved Hide resolved

for receipt in transaction_info.receipts_outcome.iter() {
total_gas_burnt += receipt.outcome.gas_burnt;
total_tokens_burnt += receipt.outcome.tokens_burnt;

if receipt.outcome.logs.is_empty() {
eprintln!("Logs [{}]: No logs", receipt.outcome.executor_id);
} else {
eprintln!("Logs [{}]:", receipt.outcome.executor_id);
eprintln!(" {}", receipt.outcome.logs.join("\n "));
};
}

eprintln!(
"Gas burnt: {}",
crate::common::NearGas::from_gas(total_gas_burnt)
);
eprintln!(
"Tokens burnt: {}",
crate::types::near_token::NearToken::from_yoctonear(total_tokens_burnt)
);
frolvanya marked this conversation as resolved.
Show resolved Hide resolved

match &transaction_info.status {
near_primitives::views::FinalExecutionStatus::NotStarted
| near_primitives::views::FinalExecutionStatus::Started => unreachable!(),
Expand Down
Loading