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

CLI: option-wrap congestion BIC #1837

Merged
merged 4 commits into from
Jan 15, 2024
Merged
Changes from all commits
Commits
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
20 changes: 12 additions & 8 deletions cli/src/wallet_cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,21 +323,23 @@ impl FromStr for OutputSelector {
pub async fn accounts_command(wallet: &Wallet) -> Result<(), Error> {
let wallet_data = wallet.data().await;
let accounts = wallet_data.accounts();
let hrp = wallet.client().get_bech32_hrp().await?;

println_log_info!("Accounts:\n");

for account in accounts {
let output_id = account.output_id;
let account_id = account.output.as_account().account_id_non_null(&output_id);
let account_address = account_id.to_bech32(wallet.client().get_bech32_hrp().await?);
let account_address = account_id.to_bech32(hrp);
let bic = wallet
.client()
.get_account_congestion(&account_id)
.await?
.block_issuance_credits;
.await
.map(|r| r.block_issuance_credits)
.ok();

println_log_info!(
"{:<16} {output_id}\n{:<16} {account_id}\n{:<16} {account_address}\n{:<16} {bic}\n",
"{:<16} {output_id}\n{:<16} {account_id}\n{:<16} {account_address}\n{:<16} {bic:?}\n",
"Output ID:",
"Account ID:",
"Account Address:",
Expand Down Expand Up @@ -698,21 +700,23 @@ pub async fn implicit_account_transition_command(
pub async fn implicit_accounts_command(wallet: &Wallet) -> Result<(), Error> {
let wallet_data = wallet.data().await;
let implicit_accounts = wallet_data.implicit_accounts();
let hrp = wallet.client().get_bech32_hrp().await?;

println_log_info!("Implicit accounts:\n");

for implicit_account in implicit_accounts {
let output_id = implicit_account.output_id;
let account_id = AccountId::from(&output_id);
let account_address = account_id.to_bech32(wallet.client().get_bech32_hrp().await?);
let account_address = account_id.to_bech32(hrp);
let bic = wallet
.client()
.get_account_congestion(&account_id)
.await?
.block_issuance_credits;
.await
.map(|r| r.block_issuance_credits)
.ok();

println_log_info!(
"{:<16} {output_id}\n{:<16} {account_id}\n{:<16} {account_address}\n{:<16} {bic}\n",
"{:<16} {output_id}\n{:<16} {account_id}\n{:<16} {account_address}\n{:<16} {bic:?}\n",
"Output ID:",
"Account ID:",
"Account Address:",
Expand Down