From 51b3622bcba1b1917ab4f4b2dcc1bc2e24aa60bb Mon Sep 17 00:00:00 2001 From: jack Date: Wed, 29 May 2024 15:19:49 +0800 Subject: [PATCH 1/2] print data attachment rights state --- cli/src/command.rs | 60 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/cli/src/command.rs b/cli/src/command.rs index cc0c129..b38ef38 100644 --- a/cli/src/command.rs +++ b/cli/src/command.rs @@ -509,6 +509,36 @@ impl Exec for RgbArgs { ); } } + if let Ok(allocations) = + contract.data(owned.name.clone(), &FilterExclude(&runtime)) + { + 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)) + { + 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)) + { + for allocation in allocations { + println!( + " rights={}, utxo={}, witness={}", + allocation.state, allocation.seal, allocation.witness + ); + } + } if *all { if let Ok(allocations) = contract .fungible(owned.name.clone(), &FilterExclude(wallet.wallet().filter())) @@ -520,6 +550,36 @@ impl Exec for RgbArgs { ); } } + if let Ok(allocations) = + contract.data(owned.name.clone(), &FilterExclude(&runtime)) + { + 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)) + { + 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)) + { + for allocation in allocations { + println!( + " rights={}, utxo={}, witness={}", + allocation.state, allocation.seal, allocation.witness + ); + } + } } // TODO: Print out other types of state } From 4f1ced75fcb837a4d88acd43dd7220dfb17e4301 Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Sat, 8 Jun 2024 18:52:01 +0200 Subject: [PATCH 2/2] cli: fix display of other state types --- cli/src/command.rs | 49 +++++++++++++++------------------------------- 1 file changed, 16 insertions(+), 33 deletions(-) diff --git a/cli/src/command.rs b/cli/src/command.rs index b38ef38..b6492bc 100644 --- a/cli/src/command.rs +++ b/cli/src/command.rs @@ -497,11 +497,10 @@ 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", @@ -509,9 +508,7 @@ impl Exec for RgbArgs { ); } } - 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={}", @@ -519,9 +516,7 @@ impl Exec for RgbArgs { ); } } - 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={}", @@ -529,20 +524,15 @@ impl Exec for RgbArgs { ); } } - 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", @@ -550,38 +540,31 @@ impl Exec for RgbArgs { ); } } - 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 {