Skip to content

Conversation

DRadmir
Copy link
Contributor

@DRadmir DRadmir commented Oct 11, 2025

Summary

Show reserved fees info text only when user taps Max button for stake/freeze operations.

Changes

  • Info text appears only when entering exact maximum amount (via Max button)
  • Removed StakeMinimumValueValidator - fee reservation now integrated into maxBalance calculation
  • Extracted shouldReserveFee and reserveForFee as computed properties
  • Improved naming: availableBalanceForStakingavailableBalanceForMaxStaking

TODO

  • Manual testing

Introduces StakeMinimumValueValidator to validate stake amounts while ensuring users have sufficient balance to cover both the stake and network fee reserves.

Key changes:
- Add StakeMinimumValueValidator checking available balance >= value + reservedForFee
- Add TransferError.insufficientStakeBalance with detailed breakdown
- Integrate validator into AmountSceneViewModel for .stake and .freeze operations
- Tron staking excluded (no fee reservation required)
- Comprehensive test coverage for validator and integration

This prevents users from staking amounts that would leave insufficient balance for transaction fees, improving user experience with clear error messages.
…take-minimum-validator-with-fee-reservation

# Conflicts:
#	core
Remove StakeMinimumValueValidator in favor of automatic fee reservation in maxBalance calculation. Fee handling now integrated directly into balance computation, showing info text only when entering exact maximum amount.
…take-minimum-validator-with-fee-reservation

# Conflicts:
#	core
…take-minimum-validator-with-fee-reservation

# Conflicts:
#	core
@DRadmir DRadmir marked this pull request as ready for review October 11, 2025 15:40
Reworded the 'transfer.reserved_fees' string in all supported languages to clarify that the reserved amount covers future network fees, not just withdrawal fees. Updated the Transaction model to make 'blockNumber' and 'sequence' non-optional, and removed the 'transaction' property from PushNotificationTransaction for simplification.
Revised the 'transfer.reserved_fees' string in Localized.swift and all supported language files for improved clarity and consistency. The message now consistently states that the amount is left in the balance to cover future network fees, rather than being left out or excluded.
Updated the Transaction struct to allow blockNumber and sequence to be optional, reflecting cases where these values may not be present. Also updated PushNotificationTransaction to include a Transaction instance, ensuring richer notification payloads.
@gemcoder21 gemcoder21 merged commit 413c459 into main Oct 11, 2025
@gemcoder21 gemcoder21 deleted the feature/stake-minimum-validator-with-fee-reservation branch October 11, 2025 21:17
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.

2 participants