Repository navigation
feat(frontend): add balance dust filter module (#376) - #475
Open
jdjioe5-cpu wants to merge 1 commit into
Open
jdjioe5-cpu wants to merge 1 commit into
jdjioe5-cpu wants to merge 1 commit into
Conversation
- Implement frontend/src/balanceDustFilter.js to filter Horizon balance lines - Retain native XLM balance line regardless of balance amount - Filter out non-native credit balances below configurable stroop threshold (defaults to 1 stroop) - Export constants STROOPS_PER_UNIT, DEFAULT_DUST_THRESHOLD_STROOPS, and DUST_FILTER_ERROR - Support integer stroops, numbers, BigInts, and options objects without mutating input array - Add 10 Vitest single-behavior test files covering empty, happy path, boundary, native retention, immutability, constants, and invalid inputs - Add feature documentation under docs/features/balanceDustFilter.md Closes Kitewell-lab#376
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.
Summary
Implements the Horizon balance dust filter in
frontend/src/balanceDustFilter.jsto filter balance lines below a configurable minimum display threshold in stroops while always keeping native XLM per #376.Changes
frontend/src/balanceDustFilter.jsexportingfilterDustBalances(andbalanceDustFilteralias) andbalanceToStroopsasset_type === "native") regardless of balance amount1nstroop = 0.0000001){ minThresholdStroops }) without mutating the input arrayfrontend/src/balanceDustFilterConstants.js(STROOPS_PER_UNIT,DEFAULT_DUST_THRESHOLD_STROOPS,DUST_FILTER_ERROR)frontend/src/:balanceDustFilter-happy.test.js(filters zero and keeps positive balances)balanceDustFilter-native-always-kept.test.js(native XLM kept even when zero or dust)balanceDustFilter-empty.test.js(empty array handling)balanceDustFilter-boundary.test.js(threshold boundary tests at exact 1 stroop)balanceDustFilter-custom-threshold.test.js(custom stroop threshold values)balanceDustFilter-does-not-mutate.test.js(immutability of input array)balanceDustFilter-invalid-balances.test.js(non-array input rejection)balanceDustFilter-invalid-entry.test.js(non-object entry rejection)balanceDustFilter-invalid-threshold.test.js(negative threshold rejection)balanceDustFilter-constants.test.js(constant immutability verification)docs/features/balanceDustFilter.mdVerification
npm test -- --runrun fromfrontend/passes 191/191 test files and 432/432 tests cleanCloses #376