Skip to content

Commit

Permalink
cli: sort history
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Sep 20, 2024
1 parent 07c1b12 commit 329c0b9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

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

10 changes: 7 additions & 3 deletions cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ use rgb::persistence::{MemContract, StashReadProvider, Stock};
use rgb::resolvers::ContractIssueResolver;
use rgb::schema::SchemaId;
use rgb::validation::Validity;
use rgb::vm::RgbIsa;
use rgb::vm::{RgbIsa, WitnessOrd};
use rgb::{
BundleId, ContractId, DescriptorRgb, GenesisSeal, GraphSeal, Identity, OpId, OutputSeal,
RgbDescr, RgbKeychain, RgbWallet, StateType, TransferParams, WalletError, WalletProvider,
Expand Down Expand Up @@ -364,7 +364,9 @@ impl Exec for RgbArgs {
ControlFlow::Break(_) => return Ok(()),
},
};
let history = wallet.history(*contract_id, iface)?;
let history = wallet
.history(*contract_id, iface)?
.sort_by_key(|op| op.witness.map(|w| w.ord).unwrap_or(WitnessOrd::Archived));
if *details {
println!("Operation\tValue\tState\tSeal\tWitness\tOpIds");
} else {
Expand Down Expand Up @@ -582,7 +584,9 @@ impl Exec for RgbArgs {
Filter::WalletAll(rgb) if rgb.wallet().is_unspent(outpoint) => {
"-- unspent"
}
Filter::WalletAll(_) => "-- spent",
Filter::WalletAll(rgb) if rgb.wallet().has_outpoint(outpoint) => {
"-- spent"
}
_ => "-- third-party",
}
}
Expand Down

0 comments on commit 329c0b9

Please sign in to comment.