Commit 6e2dadc
fix(sdk-coin-sol): handle zero decimalPlaces in token transfer builders
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>1 parent 4a311fc commit 6e2dadc
1 file changed
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
199 | | - | |
| 199 | + | |
| 200 | + | |
200 | 201 | | |
201 | 202 | | |
202 | 203 | | |
| |||
0 commit comments