Skip to content

feat(AmountInput): migrate to native Amount type support - #75

Merged
Gaubee merged 1 commit into
mainfrom
feat/amount-input-v2
Dec 22, 2025
Merged

Gaubee merged 1 commit into
mainfrom
feat/amount-input-v2

Conversation

@Gaubee

@Gaubee Gaubee commented Dec 22, 2025

Copy link
Copy Markdown
Contributor

Summary

Migrates AmountInput component to use native Amount type instead of strings.

Breaking Changes

  • value: Amount | null (was string)
  • onChange: (Amount | null) => void (was string => void)
  • balance: Amount (was string)
  • max: Amount (was string)

Changes

  • AmountInput component: Now works natively with Amount objects
    • Internal string state for input display
    • Parses user input to Amount on every keystroke
    • Validates against decimals precision automatically
    • Derives decimals/symbol from balance Amount when available
  • useSend hook: state.amount is now Amount | null
  • SendPage: Integrated with new AmountInput API
  • Tests: Updated all test files with Amount objects
  • Stories: Updated to demonstrate Amount usage

Benefits

  • Type-safe amount handling end-to-end
  • No more string parsing at component boundaries
  • Automatic precision validation
  • Cleaner API that matches the Amount type system

Closes #65

BREAKING CHANGE: AmountInput now uses Amount objects instead of strings

- value: Amount | null (was string)
- onChange: (Amount | null) => void (was string => void)
- balance: Amount (was string)
- max: Amount (was string)

Updates:
- useSend hook: state.amount is now Amount | null
- SendPage: integrated with new AmountInput API
- Tests: updated all test files with Amount objects
- Stories: updated to use Amount for demos

Closes #65
@Gaubee
Gaubee merged commit 56d2fee into main Dec 22, 2025
3 checks passed
@Gaubee
Gaubee deleted the feat/amount-input-v2 branch January 4, 2026 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

创建 AmountInput V2 组件

1 participant