Skip to content

Conversation

@FedericoLuque
Copy link
Contributor

@FedericoLuque FedericoLuque commented Dec 23, 2025

What does this PR do?

Fixes #2332

This PR introduces a real-time bondestimation feature to the Maker Order Form. It improves the User Experience by providing immediate feedback on the capital required to create an order, eliminating guesswork for the user.

Key Changes:

  • Real-time Calculation: Added logic to calculate the required Fidelity Bond in sats dynamically as the user adjusts the Amount, Premium, or Bond Size
    percentage.
  • UI Update: Displays the "Estimated Bond: [Value] Sats" directly below the order summary text in the Maker Form.
  • New Utility: Created frontend/src/utils/bondCalculator.ts to centralize the bond calculation logic, supporting both Fiat and Swap modes.
  • Edge Cases: Handles Amount Ranges by calculating the bond based on the maximum amount in the range to ensure safety.
  • Localization: Added translations for the string "Estimated Bond" across all supported languages.

This allows makers to know exactly how many sats they need in their wallet before clicking "Create Order".

Checklist before merging

  • Install pre-commit and initialize it: pip install pre-commit, then pre-commit install. Pre-commit installs git hooks that automatically check the codebase. If pre-commit fails when you commit your changes, please fix the problems it points out.

fav.mode,
maker.coordinator,
federationUpdatedAt,
]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling this method here kind of isolates this logic from the rest, to help future developers understand whatś happening and even if we duplicate code, I did rather move this logic to a regular function and call it at the end of every handle...() function (when it applies), instead of checking so many maker attributes.

}
}

if (amountToCalc === null) return null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const amountToCalc: number = isRange ? maxAmount : amount

  if (!amountToCalc) return null;

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.

Real-time Estimated Bond Preview in Maker Order Form

2 participants