fix(sdk-coin-sol): fix decimalPlaces falsy check in solInstructionsFactory#8381
Merged
ArunBala-Bitgo merged 1 commit intomasterfrom Apr 1, 2026
Merged
fix(sdk-coin-sol): fix decimalPlaces falsy check in solInstructionsFactory#8381ArunBala-Bitgo merged 1 commit intomasterfrom
ArunBala-Bitgo merged 1 commit intomasterfrom
Conversation
6e2dadc to
17b8ab5
Compare
Solana SPL tokens with 0 decimal places (e.g. NFTs) fail during pending approval because decimalPlaces is checked with a truthy comparison. In JavaScript, 0 is falsy, so the condition `data.params.decimalPlaces` evaluates to false even when decimalPlaces is explicitly set to 0. This causes the code to skip the sendParams/data.params branch, fall through to the token registry lookup (which fails for unsupported tokens), and throw "Could not determine token information" or "Invalid token name". Use `!= null` instead of truthy checks to correctly handle 0 as a valid value while rejecting both null and undefined. This is one of the standard cases where loose equality is preferred over strict. Changed in three locations: - tokenTransferBuilder.ts buildImplementation() - transferBuilderV2.ts buildImplementation() - solInstructionFactory.ts tokenTransferInstruction() TICKET: CECHO-606 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
17b8ab5 to
d638c12
Compare
Contributor
mullapudipruthvik
left a comment
There was a problem hiding this comment.
Code review
No issues found. Checked for: CLAUDE.md compliance, bugs, error handling, security, bot-specific failure modes, database operations, code comment accuracy.
✅ This PR looks safe to approve — small, trivial change with no logic modifications.
mullapudipruthvik
approved these changes
Apr 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Solana unsupported SPL NFTs with 0 decimal places fail during pending approval because decimalPlaces is checked with a truthy comparison. In JavaScript, 0 is falsy, so the condition
data.params.decimalPlacesevaluates to false even when decimalPlaces is explicitly set to 0. This causes the code to skip the sendParams/data.params branch, fall through to the token registry lookup (which fails for unsupported tokens), and throw "Invalid token name".Replace truthy checks with
!=nullin this location:TICKET: CECHO-606