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
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2023-01-20 21:45:37 +00:00
|
|
|
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;
|
|
|
|
|
2023-01-20 21:45:37 +00:00
|
|
|
/// Fiat name
|
2023-01-25 19:48:38 +00:00
|
|
|
final Decimal minAmount;
|
2023-01-20 21:45:37 +00:00
|
|
|
|
|
|
|
/// Fiat name
|
2023-01-25 19:48:38 +00:00
|
|
|
final Decimal maxAmount;
|
2023-01-20 21:45:37 +00:00
|
|
|
|
|
|
|
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(
|
2023-01-20 21:45:37 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|