stack_wallet/lib/models/buy/response_objects/fiat.dart
2024-05-27 18:01:41 -06:00

56 lines
1.1 KiB
Dart

/*
* This file is part of Stack Wallet.
*
* Copyright (c) 2023 Cypher Stack
* All Rights Reserved.
* The code is distributed under GPLv3 license, see LICENSE file for details.
* Generated by Cypher Stack on 2023-05-26
*
*/
import 'package:decimal/decimal.dart';
class Fiat {
/// Fiat ticker
final String ticker;
/// Fiat name
final String name;
/// Fiat name
final Decimal minAmount;
/// Fiat name
final Decimal maxAmount;
Fiat({
required this.ticker,
required this.name,
required this.minAmount,
required this.maxAmount,
});
factory Fiat.fromJson(Map<String, dynamic> json) {
try {
return Fiat(
ticker: "${json['ticker']}",
name: "${json['name']}", // TODO nameFromTicker
minAmount: Decimal.parse("${json['minAmount'] ?? 0}"),
maxAmount: Decimal.parse("${json['maxAmount'] ?? 0}"),
);
} catch (e) {
rethrow;
}
}
Map<String, dynamic> toJson() {
final map = {
"ticker": ticker,
"name": name,
"min_amount": minAmount,
"max_amount": maxAmount,
};
return map;
}
}