#1176: Show all on-chain assets in receive amount dropdown#1264
Open
Maxnflaxl wants to merge 2 commits into
Open
#1176: Show all on-chain assets in receive amount dropdown#1264Maxnflaxl wants to merge 2 commits into
Maxnflaxl wants to merge 2 commits into
Conversation
onAssetInfo emitted assetsListChanged on every asset-info reply. With the small held-assets list that was cheap, but rebuilding the full on-chain list (~200 assets) once per reply is O(N^2) and freezes the UI while a burst of replies drains. Debounce the signal through a 100ms single-shot timer so a burst collapses into one rebuild.
The requested-amount picker only listed assets the wallet already held, so a confidential asset couldn't be requested unless you owned it. Load the full on-chain list in the background when the receive view opens, falling back to the held-assets list until it arrives. Keep the picker always enabled so a CA can be chosen even in a BEAM-only wallet, and re-map the current selection by asset id when the list grows.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1176.
Problem
On the Receive screen, the "requested amount" asset picker only listed assets the wallet already held (
getAssetsNZ()— non-zero balance). A confidential asset could not be requested unless you already owned it.Changes
getAssetsListFull()) in the background when it opens, falling back to the wallet's held assets as an instant placeholder until the list arrives. The picker is always enabled so a CA can be chosen even in a BEAM-only wallet, and the current selection is re-mapped by asset id when the list grows.AssetsManager::onAssetInfopreviously emittedassetsListChangedon every asset-info reply. Rebuilding the full ~200-asset list once per reply is O(N²) and froze the UI while a burst of replies drained (e.g. navigating away with the dropdown open). The signal is now debounced through a 100 ms single-shot timer so a burst collapses into one rebuild. This benefits every consumer of the list (send, settings, asset swap).Testing
Built and verified in a Release build: the receive picker lists all on-chain assets, a non-held CA can be selected by typing its AID into the search box, BEAM remains the default, the Send picker is unchanged, and navigating away with the dropdown open no longer hangs.