Description: fromStellarAmount calls BigInt(stroopsStr) without validation. Non-integer strings cause runtime errors with cryptic BigInt messages.
Requirements:
- Validate that
stroopsStr is a valid integer string (no decimal point)
- Throw
TypeError on invalid input
- Handle empty string and leading zeros
- Add JSDoc documentation
Suggested execution steps:
- Validate:
if (!/^-?\d+$/.test(stroopsStr)) throw new TypeError(...)
- Handle negative values appropriately
- Ensure empty string is rejected
- Add JSDoc
Example commit message:
fix(stellar-utils): add input validation to fromStellarAmount
Validates integer string format before BigInt conversion, throwing
descriptive errors on invalid input.
Description:
fromStellarAmountcallsBigInt(stroopsStr)without validation. Non-integer strings cause runtime errors with cryptic BigInt messages.Requirements:
stroopsStris a valid integer string (no decimal point)TypeErroron invalid inputSuggested execution steps:
if (!/^-?\d+$/.test(stroopsStr)) throw new TypeError(...)Example commit message: