Skip to content

Conversation

@DRadmir
Copy link
Contributor

@DRadmir DRadmir commented Oct 7, 2025

Previously, the reserved fee info text would display even when the input amount was zero. This change adds a check to ensure the info text only appears when the user has entered a non-zero amount that would trigger the reserved fee warning.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @DRadmir, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves an issue where the reserved fee information text was inappropriately displayed even when a user entered a zero amount for staking or freezing. The changes ensure that this warning message is only presented for valid, non-zero input amounts that would actually trigger a fee reservation, thereby enhancing the user interface's clarity and relevance.

Highlights

  • Reserved Fee Info Text Logic: The logic for displaying the reserved fee info text in staking and freezing operations has been updated to prevent it from showing when the input amount is zero.
  • Input Validation: A new condition !inputValue.isZero was added to the guard statement in AmountSceneViewModel.swift to explicitly check for non-zero input amounts before displaying the fee warning.
  • Unit Test Coverage: A new unit test has been introduced in AmountSceneViewModelTests.swift to verify that the info text is correctly hidden (set to nil) when the input amount is zero.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request fixes an issue where the reserved fee info text was displayed for zero amounts during staking. The change adds a check to ensure the input value is non-zero before showing the text, and adds a test case to cover this scenario. While the fix is correct for the reported issue, it appears to cause a regression in a related scenario, which will likely make an existing test case fail. I've left a comment with details on how to address this.

Comment on lines +105 to +107
guard let inputValue = try? formatter.inputNumber(from: amountInputModel.text, decimals: asset.decimals.asInt),
!inputValue.isZero, inputValue >= availableBalanceForStaking, inputValue <= availableValue
else { return nil }
Copy link
Contributor

Choose a reason for hiding this comment

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

high

This change correctly prevents the info text from showing when the user types '0'. However, it seems to introduce a regression in a related scenario, which will likely cause the stakingMaxWithInsufficientBalance test to fail. In that test, the user has a balance smaller than the reserved fee. Pressing the 'Max' button sets the input to '0', and the test expects the info text to be shown to explain why the max amount is zero. With your change, it will be hidden.

Please consider if this change in behavior is intended. If so, the test should be updated to expect infoText == nil. Otherwise, the logic here might need to be adjusted to handle this edge case differently.

Previously, the reserved fee info text would display even when the input amount was zero. This change adds a check to ensure the info text only appears when the user has entered a non-zero amount that would trigger the reserved fee warning.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@gemcoder21 gemcoder21 merged commit 1bc5715 into main Oct 8, 2025
1 check passed
@gemcoder21 gemcoder21 deleted the reserved-fee-fix branch October 8, 2025 16:45
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Gem Wallet - (iOS, Android, Core) Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants