Skip to content

Implement automatic fee normalization and rounding #26

Description

@Just-Bamford

Problem

Fee estimates from \src/transaction/estimateFee.ts\ return precise values, but Stellar requires stroops (smallest unit). Rounding inconsistencies between client and server can cause submission failures. No normalization utility exists.

Solution

Add
ormalizeFee(fee: string | number)\ utility in \src/shared/utils.ts\ that ensures fees are integers in stroops, with proper rounding. Use throughout fee estimation and transaction building.

Acceptance Criteria


  • ormalizeFee()\ added to \src/shared/utils.ts\
  • Accepts string or number, returns integer stroops
  • Implements proper rounding (banker's rounding or floor)
  • \estimateFee()\ uses normalization before returning
  • Transaction builders use normalized fees
  • Tests added covering decimal, string, edge cases
  • Export in \src/shared/index.ts\

Note for contributors

Reference Stellar's stroop definition (1 XLM = 10,000,000 stroops). Test rounding edge cases. Add tests to \src/tests/shared.test.ts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave programbackendBackend / SDK logicenhancementNew feature or request

    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