Skip to content

Add helper utility for formatting Stellar asset amounts #457

Description

@Cjay-Cyber-2

Description — what to implement and the why/impact.

Stellar ledger amounts are often represented in stroops or raw string decimals. Having a dedicated helper utility to format and parse Stellar asset amounts cleanly avoids precision errors and standardizes display across API responses.

Context & Requirements — background, constraints, design references, edge cases;

  • Grounded in src/utils/ or src/services/.
  • Must handle standard decimal string conversions safely without floating-point inaccuracies.
  • Adhere to TypeScript strict type checking.

Acceptance Criteria — a checklist ("- [ ] ...") of specific, testable conditions that define "done^".

  • Implement asset amount formatting and parsing helper functions.
  • Add unit tests covering zero, standard decimal values, and large integer edge cases.

Implementation Guidance — likely files/modules to touch

  • Likely files: src/utils/stellar.ts or a new src/utils/format.ts file.
  • Suggested approach: Use standard JavaScript BigInt or string manipulation helpers suitable for Stellar asset precision.

Testing & Validation — how the contributor should prove it works

  • Run npm test to confirm unit tests pass successfully.

Submission Guidelines — must open a PR that includes "Closes #"; assignment is required before starting.


Wave complexity: Trivial

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave programcomplexity: trivialDrips Wave — small, well-bounded taskdrips-waveTracked in a Drips Wave programenhancementNew feature or requeststellar

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions