stack_wallet/lib/models/buy/response_objects/fiat.dart

56 lines
1.1 KiB
Dart
Raw Normal View History

2023-05-26 21:21:16 +00:00
/*
* 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';
2023-01-11 17:49:59 +00:00
class Fiat {
/// Fiat ticker
final String ticker;
/// Fiat name
final String name;
/// Fiat name
2023-01-25 19:48:38 +00:00
final Decimal minAmount;
/// Fiat name
2023-01-25 19:48:38 +00:00
final Decimal maxAmount;
Fiat(
{required this.ticker,
required this.name,
2023-01-25 19:48:38 +00:00
required this.minAmount,
required this.maxAmount});
2023-01-11 17:49:59 +00:00
factory Fiat.fromJson(Map<String, dynamic> json) {
try {
return Fiat(
ticker: "${json['ticker']}",
name: "${json['name']}", // TODO nameFromTicker
2023-01-25 19:48:38 +00:00
minAmount: Decimal.parse("${json['minAmount'] ?? 0}"),
maxAmount: Decimal.parse("${json['maxAmount'] ?? 0}"),
2023-01-11 17:49:59 +00:00
);
} catch (e) {
rethrow;
}
}
Map<String, dynamic> toJson() {
final map = {
"ticker": ticker,
"name": name,
2023-01-25 19:48:38 +00:00
"min_amount": minAmount,
"max_amount": maxAmount,
2023-01-11 17:49:59 +00:00
};
return map;
}
}