fix(sui): use balance variable as-is #1055
Merged
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.
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 atotalBalance
property, which was correctly extracted and assigned to thebalance
variable. However, the code then incorrectly attempted to accessbalance.totalBalance
again, treating the primitive value as if it were still the full response object. This would have resulted inundefined
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
Confidence score: 5/5