Skip to content

Conversation

milapsheth
Copy link
Member

@milapsheth milapsheth commented Sep 30, 2025

Note

Fix mintCoins to log and return the numeric balance directly instead of accessing balance.totalBalance.

Written by Cursor Bugbot for commit c51a1b5. This will update automatically on new commits. Configure here.

Greptile Overview

Updated On: 2025-09-30 05:59:10 UTC

Summary

This PR fixes a bug in the Sui ITS (Interchain Token Service) balance handling logic. The change corrects an error in the `mintCoins` function within `sui/its.js` where the code was incorrectly trying to access `.totalBalance` on a variable that already contained the `totalBalance` primitive value.

The issue was in how the balance was being handled after calling client.getBalance(). The API returns an object with a totalBalance property, which was correctly extracted and assigned to the balance variable. However, the code then incorrectly attempted to access balance.totalBalance again, treating the primitive value as if it were still the full response object. This would have resulted in undefined being printed for the balance display and returned as the first element of the function's return array.

This fix ensures that balance values are properly handled throughout the Sui ITS implementation, maintaining consistency with how other blockchain implementations in the codebase handle balance extraction and display. The change aligns with the established pattern of extracting the needed value once and using it directly, rather than repeatedly accessing nested properties.

Important Files Changed

Changed Files
Filename Score Overview
sui/its.js 5/5 Fixed incorrect property access on balance variable that was already extracted from API response

Confidence score: 5/5

  • This PR is safe to merge with minimal risk as it fixes a clear logical error
  • Score reflects a straightforward bug fix that corrects improper variable usage without changing core logic
  • No files require special attention as the change is isolated and the fix is obvious

@milapsheth milapsheth requested a review from a team as a code owner September 30, 2025 05:58
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@milapsheth milapsheth enabled auto-merge (squash) September 30, 2025 05:59
@milapsheth milapsheth merged commit 9bb9b81 into main Sep 30, 2025
10 checks passed
@milapsheth milapsheth deleted the fix/sui-its-balance branch September 30, 2025 06:34
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