Skip to content

Commit

Permalink
Merge pull request #207 from RGB-WG/print-other-state
Browse files Browse the repository at this point in the history
Display other state types in cli
  • Loading branch information
dr-orlovsky authored Jun 8, 2024
2 parents 58972e6 + 4f1ced7 commit 7a2fced
Showing 1 changed file with 50 additions and 7 deletions.
57 changes: 50 additions & 7 deletions cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,31 +497,74 @@ impl Exec for RgbArgs {
}

println!("\nOwned:");
let filter = wallet.wallet().filter();
for owned in &contract.iface.assignments {
println!(" {}:", owned.name);
if let Ok(allocations) =
contract.fungible(owned.name.clone(), wallet.wallet().filter())
{
if let Ok(allocations) = contract.fungible(owned.name.clone(), &filter) {
for allocation in allocations {
println!(
" amount={}, utxo={}, witness={} # owned by the wallet",
allocation.state, allocation.seal, allocation.witness
);
}
}
if let Ok(allocations) = contract.data(owned.name.clone(), &filter) {
for allocation in allocations {
println!(
" data={}, utxo={}, witness={}",
allocation.state, allocation.seal, allocation.witness
);
}
}
if let Ok(allocations) = contract.attachments(owned.name.clone(), &filter) {
for allocation in allocations {
println!(
" attachments={}, utxo={}, witness={}",
allocation.state, allocation.seal, allocation.witness
);
}
}
if let Ok(allocations) = contract.rights(owned.name.clone(), &filter) {
for allocation in allocations {
println!(" utxo={}, witness={}", allocation.seal, allocation.witness);
}
}

let filter = FilterExclude(filter);
if *all {
if let Ok(allocations) = contract
.fungible(owned.name.clone(), &FilterExclude(wallet.wallet().filter()))
{
if let Ok(allocations) = contract.fungible(owned.name.clone(), &filter) {
for allocation in allocations {
println!(
" amount={}, utxo={}, witness={} # owner unknown",
allocation.state, allocation.seal, allocation.witness
);
}
}
if let Ok(allocations) = contract.data(owned.name.clone(), &filter) {
for allocation in allocations {
println!(
" data={}, utxo={}, witness={} # owner unknown",
allocation.state, allocation.seal, allocation.witness
);
}
}
if let Ok(allocations) = contract.attachments(owned.name.clone(), &filter) {
for allocation in allocations {
println!(
" attachments={}, utxo={}, witness={} # owner unknown",
allocation.state, allocation.seal, allocation.witness
);
}
}
if let Ok(allocations) = contract.rights(owned.name.clone(), &filter) {
for allocation in allocations {
println!(
" utxo={}, witness={} # owner unknown",
allocation.seal, allocation.witness
);
}
}
}
// TODO: Print out other types of state
}
}
Command::Issue {
Expand Down

0 comments on commit 7a2fced

Please sign in to comment.