Skip to content

Commit

Permalink
No longer display withdrawn auction NFTs when viewing balance in pcli (
Browse files Browse the repository at this point in the history
…#4826)

## Describe your changes
pcli no longer displays withdrawn auction NFTs when running ```pcli view
balance```

## Issue ticket number and link
#4820 

## Checklist before requesting a review

- [x] If this code contains consensus-breaking changes, I have added the
"consensus-breaking" label. Otherwise, I declare my belief that there
are not consensus-breaking changes, for the following reason: I have
only modified what pcli filters out before displaying balances and added
a function in denom_metadata that matches a similar function for LPNFTs.

> After completing a number of auctions, viewing my balances through
pcli has become increasingly difficult due to all of my previously
withdrawn auction NFTs. I decided to not filter out closed auction
positions so they can serve as a reminder to withdraw them, matching the
default behavior of the swap frontend.
  • Loading branch information
masonyonkers authored Aug 23, 2024
1 parent 8ee733c commit 7e3a428
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crates/bin/pcli/src/command/view/balance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,12 @@ impl BalanceCmd {
(*index, asset.value(sum.into()))
})
})
// Exclude withdrawn LPNFTs.
// Exclude withdrawn LPNFTs and withdrawn auction NFTs.
.filter(|(_, value)| match asset_cache.get(&value.asset_id) {
None => true,
Some(denom) => !denom.is_withdrawn_position_nft(),
Some(denom) => {
!denom.is_withdrawn_position_nft() && !denom.is_withdrawn_auction_nft()
}
});

for (index, value) in rows {
Expand Down
4 changes: 4 additions & 0 deletions crates/core/asset/src/asset/denom_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,10 @@ impl Metadata {
self.starts_with("auctionnft_")
}

pub fn is_withdrawn_auction_nft(&self) -> bool {
self.starts_with("auctionnft_2")
}

pub fn is_opened_position_nft(&self) -> bool {
let prefix = "lpnft_opened_".to_string();

Expand Down

0 comments on commit 7e3a428

Please sign in to comment.