Skip to content

Commit

Permalink
cli: fix display of other state types
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Jun 8, 2024
1 parent 51b3622 commit 4f1ced7
Showing 1 changed file with 16 additions and 33 deletions.
49 changes: 16 additions & 33 deletions cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,91 +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(), &FilterExclude(&runtime))
{
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(), &FilterExclude(&runtime))
{
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(), &FilterExclude(&runtime))
{
if let Ok(allocations) = contract.rights(owned.name.clone(), &filter) {
for allocation in allocations {
println!(
" rights={}, utxo={}, witness={}",
allocation.state, allocation.seal, allocation.witness
);
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(), &FilterExclude(&runtime))
{
if let Ok(allocations) = contract.data(owned.name.clone(), &filter) {
for allocation in allocations {
println!(
" data={}, utxo={}, witness={}",
" data={}, utxo={}, witness={} # owner unknown",
allocation.state, allocation.seal, allocation.witness
);
}
}
if let Ok(allocations) =
contract.attachments(owned.name.clone(), &FilterExclude(&runtime))
{
if let Ok(allocations) = contract.attachments(owned.name.clone(), &filter) {
for allocation in allocations {
println!(
" attachments={}, utxo={}, witness={}",
" attachments={}, utxo={}, witness={} # owner unknown",
allocation.state, allocation.seal, allocation.witness
);
}
}
if let Ok(allocations) =
contract.rights(owned.name.clone(), &FilterExclude(&runtime))
{
if let Ok(allocations) = contract.rights(owned.name.clone(), &filter) {
for allocation in allocations {
println!(
" rights={}, utxo={}, witness={}",
allocation.state, allocation.seal, allocation.witness
" utxo={}, witness={} # owner unknown",
allocation.seal, allocation.witness
);
}
}
}
// TODO: Print out other types of state
}
}
Command::Issue {
Expand Down

0 comments on commit 4f1ced7

Please sign in to comment.