Skip to content

Add input validation to fromStellarAmount #96

Description

@therealjhay

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:

  1. Validate: if (!/^-?\d+$/.test(stroopsStr)) throw new TypeError(...)
  2. Handle negative values appropriately
  3. Ensure empty string is rejected
  4. 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.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions