Skip to content

Create shared token amount formatting utilities #339

@ogazboiz

Description

@ogazboiz

Join our community: https://t.me/+DOylgFv1jyJlNzM0

Description

On-chain amounts are raw i128 integers. Each component handles formatting differently (or not at all), leading to inconsistencies and potential precision loss.

What Needs to Happen

  • Create frontend/lib/amount.ts:
    • formatAmount(raw: bigint, decimals: number): string
    • parseAmount(display: string, decimals: number): bigint
    • formatRate(ratePerSec: bigint, decimals: number): string — "0.0001 USDC/sec" and "8.64 USDC/day"
    • hasValidPrecision(input: string, decimals: number): boolean
    • toStroops(value: string): bigint
  • Apply consistently across StreamCreationWizard, dashboard cards, stream detail, LiveCounter

Files

  • frontend/lib/amount.ts (create)

Acceptance Criteria

  • All displays use the shared utility
  • Inputs reject invalid precision
  • Rate shown per second and per day

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programfrontendFrontend related tasks

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