Metadata
| Field |
Value |
| Domain |
Testing |
| Difficulty |
Easy (1β2 Days) |
| Effort Estimate |
effort: 2h |
| Priority |
P2-Medium |
| Labels |
good first issue, easy, Stellar Wave |
| Target Branch |
dev |
| Depends On |
None |
π― Context & Goal
Converting between Stellar stroops (1 XLM = 10,000,000 stroops) and human-readable decimal XLM/USDC amounts must be accurate down to the single stroop. Floating point math can introduce precision errors when handling financial balances.
This issue creates unit tests in tests/unit/utils/unit-conversion.test.ts testing stroopsToXlm() and xlmToStroops() across boundary values (0, 1 stroop, fractional stroops, 100,000 XLM).
π Target Files
tests/unit/utils/unit-conversion.test.ts -> Unit conversion test suite
src/utils/unit-conversion.utils.ts -> Conversion utility functions
π Implementation Tasks
π οΈ Technical Guidance
import Decimal from 'decimal.js';
export function stroopsToXlm(stroops: bigint | string): string {
return new Decimal(stroops.toString()).dividedBy(10000000).toFixed(7);
}
export function xlmToStroops(xlm: string | number): bigint {
return BigInt(new Decimal(xlm).times(10000000).toFixed(0));
}
π References & Related
β³ Delivery Window
This issue should be completed within 1 day(s) of assignment.
Contribution Workflow
- Branch off
dev: git checkout -b feature/descriptive-name dev
- Implement all tasks in the checklist above.
- Run all CI checks locally (see DEVELOPMENT.md).
- Open a Pull Request targeting
dev.
- Link this issue in your PR description:
Closes #XX.
β
Acceptance Criteria
Metadata
effort: 2hgood first issue,easy,Stellar Wavedevπ― Context & Goal
Converting between Stellar stroops (1 XLM = 10,000,000 stroops) and human-readable decimal XLM/USDC amounts must be accurate down to the single stroop. Floating point math can introduce precision errors when handling financial balances.
This issue creates unit tests in tests/unit/utils/unit-conversion.test.ts testing stroopsToXlm() and xlmToStroops() across boundary values (0, 1 stroop, fractional stroops, 100,000 XLM).
π Target Files
tests/unit/utils/unit-conversion.test.ts -> Unit conversion test suitesrc/utils/unit-conversion.utils.ts -> Conversion utility functionsπ Implementation Tasks
π οΈ Technical Guidance
π References & Related
β³ Delivery Window
This issue should be completed within 1 day(s) of assignment.
Contribution Workflow
dev:git checkout -b feature/descriptive-name devdev.Closes #XX.β Acceptance Criteria
devbranch (NOTmain).