Files
hash-wallet/cw_core/test/amount/utils.dart
T
Konstantin UllrichandGitHub c838012979 Enhance Money class with precision handling and zero trimming (#3548)
* feat: enhance Money class with precision handling, scale alignment, and trailing zero trimming
2026-08-24 14:48:32 +02:00

42 lines
1017 B
Dart

import 'package:cw_core/amount/money.dart';
import 'package:cw_core/currency.dart';
class FiatCurrency implements Currency {
const FiatCurrency({
required this.symbol,
required this.countryCode,
required this.fullName,
this.decimals = 2,
});
final String countryCode;
@override
final String fullName;
@override
final int decimals;
@override
final String symbol;
@override
String? get iconPath => throw UnimplementedError();
@override
String get name => throw UnimplementedError();
@override
String? get tag => throw UnimplementedError();
@override
Money parseAmount(String value) => Money.parse(value, this);
@override
Money? tryParseAmount(String value) => Money.tryParse(value, this);
}
const EUR = FiatCurrency(symbol: 'EUR', countryCode: "eur", fullName: "Euro");
const USD = FiatCurrency(symbol: 'USD', countryCode: "usd", fullName: "US Dollar");
const JPY = FiatCurrency(symbol: 'JPY', countryCode: "jpn", fullName: "Japanese Yen", decimals: 0);