Skip to content

fix: Skip fee subtraction for sponsor-paid escrow transactions - #1383

Open
FawwazLawal wants to merge 3 commits into
ripple:mainfrom
FawwazLawal:fix/1379-sponsor-fee-escrow
Open

FawwazLawal wants to merge 3 commits into
ripple:mainfrom
FawwazLawal:fix/1379-sponsor-fee-escrow

Conversation

@FawwazLawal

@FawwazLawal FawwazLawal commented Oct 26, 2026 •

Copy link
Copy Markdown

High Level Overview of Change

When an escrow transaction has its fee sponsored via SponsorFlags, the fee is not deducted
from 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.tsx and DetailTab using
getSponsorScopes(tx.SponsorFlags).includes('fee'). This fix applies the same pattern to the
three locations named in #1379:

  • metaParser.tsx line 107: findXRPAmount fee subtraction now wrapped in a !feeSponsored guard
  • EscrowFinish/Description.tsx line 49: conditional fee subtraction in the displayed amount
  • EscrowCancel/Description.tsx line 48: same pattern as EscrowFinish

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Codebase Modernization

  • Updated files to React Hooks
  • Updated files to TypeScript

All three source files were already TypeScript and already used hooks, so no conversion was
needed.

Before / After

EscrowFinish 485D3639A9E5AF3C899B63BC6EA088C8D925BED50DFEEA9B72E07F3C27D6FA73 on 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:

The escrowed amount of ✕100.00 XRP was delivered to rp33KjHv6EAiRUapynMi8qp8iWdYLik7YS
(✕99.00 XRP after transaction cost)

image

After, the sponsored fee is not subtracted:

The escrowed amount of ✕100.00 XRP was delivered to rp33KjHv6EAiRUapynMi8qp8iWdYLik7YS
(✕100.00 XRP after transaction cost)

image

EscrowCancel/Description.tsx uses the identical pattern.

Test Plan

Two tests added, one per affected description component:

  • EscrowFinish/test/EscrowFinishDescription.test.tsx, the case "skips fee subtraction when
    SponsorFlags has fee scope"
  • EscrowCancel/test/EscrowCancelDescription.test.tsx, the same case for EscrowCancel

Each uses a new mock_data entry copied from the existing XRP case with tx.SponsorFlags = 1
added and nothing else changed, so the flag is the only variable.

Both fail against the pre-fix source and pass with the fix:

$ npm run test:ci          # pre-fix Description.tsx restored
2 failed, 8 passed, 10 total
  EscrowFinish  expected '0.0154 XRP after transaction cost', received '0.015388'
  EscrowCancel  expected '135.79', received '135.78999'

$ npm run test:ci          # with the fix
312 suites, 1870 tests, 0 failed

Full suite on Node 22.23.4, matching NODE_VERSION in nodejs.yml:

$ npm run lint:ci      exit 0    (lint:js, lint:css, format:check)
$ pre-commit run --all-files     exit 0
$ npm run test:ci      exit 0    312 suites, 1870 tests, 0 failed
$ npm run build        exit 0    3.04s
$ npm run build-ts     exit 0

Closes #1379

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fee-sponsored transactions show wrong “after transaction cost” / XRP-delta amounts

1 participant