fix(fee-utils): replace hardcoded XLM_PRICE with live useTokenPrice#412
Merged
Austinaminu2 merged 1 commit intoJul 26, 2026
Conversation
…ib/fee-utils.ts hardcoded XLM_PRICE = 0.12 as the default for USD fee estimates. This value becomes stale as the real XLM/USD price moves, causing the displayed fee-in-USD to be arbitrarily wrong. Changes: - Remove the XLM_PRICE constant from fee-utils.ts - Make xlmPrice an optional param (undefined -> estimatedUsd omitted) - Pass the live usdPrice from useTokenPrice('XLM') at every call site: * components/streams/create-confirmation.tsx * app/app/stream/[id]/page.tsx (WithdrawDialog + CancelDialog) Closes FlowwStar#288
brightfootlimited-collab
had a problem deploying
to
staging
July 26, 2026 15:40 — with
GitHub Actions
Failure
|
@brightfootlimited-collab Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Problem lib/fee-utils.ts hardcoded XLM_PRICE = 0.12 as the USD conversion factor for fee estimates. Once the real XLM/USD price diverges from that constant the displayed fee-in-USD becomes arbitrarily wrong. Fixes #288 ## Changes ### lib/fee-utils.ts - Removed the XLM_PRICE = 0.12 constant entirely. - Made xlmPrice an optional parameter (xlmPrice?: number). When no price is supplied (e.g. while the live fetch is still loading) estimatedUsd is undefined rather than a stale hardcoded value — matching the pre-existing estimatedUsd?: number type on FeeBreakdown. ### components/streams/create-confirmation.tsx - Imported useTokenPrice from hooks/use-token-price. - Calls useTokenPrice('XLM') and passes usdPrice ?? undefined to calculateFeeBreakdown. ### �pp/app/stream/[id]/page.tsx - Same import added. - useTokenPrice('XLM') called inside both WithdrawDialog and CancelDialog; live price forwarded to calculateFeeBreakdown. ## Tests Existing tests in tests/lib/fee-utils.test.ts are unaffected: - Tests that pass an explicit price (calculateFeeBreakdown(10_000_000, 0.5)) continue to work. - Tests that call without a price now receive estimatedUsd: undefined — none of those tests assert on estimatedUsd, so they all pass as-is.