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 8199349
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");
}
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!();
}
}
}
Expand Down Expand Up @@ -592,6 +590,7 @@ impl Exec for RgbArgs {
}

println!("\nOwned:");
println!(" State \t{:78}\tWitness", "Seal");
fn witness<S: KnownState>(
allocation: &OutputAssignment<S>,
contract: &ContractIface<MemContract<&MemContractState>>,
Expand All @@ -607,7 +606,7 @@ impl Exec for RgbArgs {
if let Ok(allocations) = contract.fungible(owned.name.clone(), &filter) {
for allocation in allocations {
println!(
" value={}, utxo={}, witness={} {}",
" {: >9}\t{}\t{} {}",
allocation.state.value(),
allocation.seal,
witness(&allocation, &contract),
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{} {}",
allocation.state,
allocation.seal,
witness(&allocation, &contract),
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{} {}",
allocation.state,
allocation.seal,
witness(&allocation, &contract),
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",
allocation.seal,
witness(&allocation, &contract),
filter.comment(allocation.seal.to_outpoint())
Expand Down

0 comments on commit 8199349

Please sign in to comment.