Repository navigation
fix: Skip fee subtraction for sponsor-paid escrow transactions - #1383
Open
FawwazLawal wants to merge 3 commits into
Open
FawwazLawal wants to merge 3 commits into
FawwazLawal wants to merge 3 commits into
Conversation
When an escrow transaction has its fee sponsored via SponsorFlags, the fee is not deducted from the sender's balance. The displayed XRP delta and "amount after" values were still subtracting the fee, showing incorrect amounts. Use getSponsorScopes to check whether the fee is sponsor-paid and conditionally skip the subtraction in metaParser, EscrowFinish, and EscrowCancel Description components.
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.
High Level Overview of Change
When an escrow transaction has its fee sponsored via
SponsorFlags, the fee is not deductedfrom the sender's balance. The explorer was still subtracting the fee when computing XRP deltas
and "amount after" values, showing incorrect amounts for sponsor-paid escrows.
Context of Change
The sponsor-fee check pattern already exists in
SimpleTab.tsxandDetailTabusinggetSponsorScopes(tx.SponsorFlags).includes('fee'). This fix applies the same pattern to thethree locations named in #1379:
metaParser.tsxline 107:findXRPAmountfee subtraction now wrapped in a!feeSponsoredguardEscrowFinish/Description.tsxline 49: conditional fee subtraction in the displayed amountEscrowCancel/Description.tsxline 48: same pattern as EscrowFinishType of Change
Codebase Modernization
All three source files were already TypeScript and already used hooks, so no conversion was
needed.
Before / After
EscrowFinish
485D3639A9E5AF3C899B63BC6EA088C8D925BED50DFEEA9B72E07F3C27D6FA73on Devnet,ledger 6565462. The fee on this transaction is ✕1.00 XRP and it is sponsored by
rKBW2aeExXst7FouxYLbRk8xSTqas6pFRN, which the page shows under Sponsor as "Transaction Fees".Before, the sponsored fee is subtracted from the displayed amount:
After, the sponsored fee is not subtracted:
EscrowCancel/Description.tsxuses the identical pattern.Test Plan
Two tests added, one per affected description component:
EscrowFinish/test/EscrowFinishDescription.test.tsx, the case "skips fee subtraction whenSponsorFlags has fee scope"
EscrowCancel/test/EscrowCancelDescription.test.tsx, the same case for EscrowCancelEach uses a new
mock_dataentry copied from the existing XRP case withtx.SponsorFlags = 1added and nothing else changed, so the flag is the only variable.
Both fail against the pre-fix source and pass with the fix:
Full suite on Node 22.23.4, matching
NODE_VERSIONinnodejs.yml:Closes #1379