Skip to content

Commit

Permalink
cli: improve state printout
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Sep 20, 2024
1 parent b36d00f commit 8e0802c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
3 changes: 1 addition & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,5 @@ features = ["all"]

[patch.crates-io]
bp-wallet = { git = "https://github.com/BP-WG/bp-wallet", branch = "develop" }
rgb-core = { git = "https://github.com/RGB-WG/rgb-core", branch = "fix/273" }
rgb-std = { git = "https://github.com/RGB-WG/rgb-std", branch = "fix/rgb-252" }
22 changes: 11 additions & 11 deletions cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,9 @@ impl Exec for RgbArgs {
let mut history = wallet.history(*contract_id, iface)?;
history.sort_by_key(|op| op.witness.map(|w| w.ord).unwrap_or(WitnessOrd::Archived));
if *details {
println!("Operation\tValue\tState\tSeal\tWitness\tOpIds");
println!("Operation\tValue \tState\t{:78}\tWitness", "Seal");
} else {
println!("Operation\tValue\tSeal\tWitness");
println!("Operation\tValue \t{:78}\tWitness", "Seal");
}

Check warning on line 373 in cli/src/command.rs

View check run for this annotation

Codecov / codecov/patch

cli/src/command.rs#L367-L373

Added lines #L367 - L373 were not covered by tests
for ContractOp {
direction,
Expand All @@ -389,7 +389,7 @@ impl Exec for RgbArgs {
if *details {
print!("\t{ty}");
}
print!(
println!(
"\t{}\t{}",
to.first().expect("at least one receiver is always present"),
witness
Expand All @@ -398,15 +398,13 @@ impl Exec for RgbArgs {
);
if *details {
println!(
"\t{}",
"\topid={}",
opids
.iter()
.map(OpId::to_string)
.collect::<Vec<_>>()
.join(", ")
.join("\n\topid=")
)
} else {
println!();
}

Check warning on line 408 in cli/src/command.rs

View check run for this annotation

Codecov / codecov/patch

cli/src/command.rs#L383-L408

Added lines #L383 - L408 were not covered by tests
}
}
Expand Down Expand Up @@ -603,11 +601,12 @@ impl Exec for RgbArgs {
.unwrap_or_else(|| s!("~"))
}

Check warning on line 602 in cli/src/command.rs

View check run for this annotation

Codecov / codecov/patch

cli/src/command.rs#L593-L602

Added lines #L593 - L602 were not covered by tests
for owned in &contract.iface.assignments {
println!(" State \t{:78}\tWitness", "Seal");

Check warning on line 604 in cli/src/command.rs

View check run for this annotation

Codecov / codecov/patch

cli/src/command.rs#L604

Added line #L604 was not covered by tests
println!(" {}:", owned.name);
if let Ok(allocations) = contract.fungible(owned.name.clone(), &filter) {
for allocation in allocations {
println!(
" value={}, utxo={}, witness={} {}",
" {: >9}\t{}\t{} {}",

Check warning on line 609 in cli/src/command.rs

View check run for this annotation

Codecov / codecov/patch

cli/src/command.rs#L609

Added line #L609 was not covered by tests
allocation.state.value(),
allocation.seal,
witness(&allocation, &contract),

Check warning on line 612 in cli/src/command.rs

View check run for this annotation

Codecov / codecov/patch

cli/src/command.rs#L612

Added line #L612 was not covered by tests
Expand All @@ -618,7 +617,7 @@ impl Exec for RgbArgs {
if let Ok(allocations) = contract.data(owned.name.clone(), &filter) {
for allocation in allocations {
println!(
" data={}, utxo={}, witness={} {}",
" {: >9}\t{}\t{} {}",

Check warning on line 620 in cli/src/command.rs

View check run for this annotation

Codecov / codecov/patch

cli/src/command.rs#L620

Added line #L620 was not covered by tests
allocation.state,
allocation.seal,
witness(&allocation, &contract),

Check warning on line 623 in cli/src/command.rs

View check run for this annotation

Codecov / codecov/patch

cli/src/command.rs#L623

Added line #L623 was not covered by tests
Expand All @@ -629,7 +628,7 @@ impl Exec for RgbArgs {
if let Ok(allocations) = contract.attachments(owned.name.clone(), &filter) {
for allocation in allocations {
println!(
" file={}, utxo={}, witness={} {}",
" {: >9}\t{}\t{} {}",

Check warning on line 631 in cli/src/command.rs

View check run for this annotation

Codecov / codecov/patch

cli/src/command.rs#L631

Added line #L631 was not covered by tests
allocation.state,
allocation.seal,
witness(&allocation, &contract),

Check warning on line 634 in cli/src/command.rs

View check run for this annotation

Codecov / codecov/patch

cli/src/command.rs#L634

Added line #L634 was not covered by tests
Expand All @@ -640,7 +639,8 @@ impl Exec for RgbArgs {
if let Ok(allocations) = contract.rights(owned.name.clone(), &filter) {
for allocation in allocations {
println!(
" utxo={}, witness={} {}",
" {: >9}\t{}\t{} {}",
"right",

Check warning on line 643 in cli/src/command.rs

View check run for this annotation

Codecov / codecov/patch

cli/src/command.rs#L642-L643

Added lines #L642 - L643 were not covered by tests
allocation.seal,
witness(&allocation, &contract),

Check warning on line 645 in cli/src/command.rs

View check run for this annotation

Codecov / codecov/patch

cli/src/command.rs#L645

Added line #L645 was not covered by tests
filter.comment(allocation.seal.to_outpoint())
Expand Down

0 comments on commit 8e0802c

Please sign in to comment.