2021-12-24 14:52:08 +02:00
|
|
|
import 'package:cw_core/transaction_info.dart';
|
2022-03-30 17:57:04 +02:00
|
|
|
import 'package:cw_core/monero_amount_format.dart';
|
2021-12-24 14:52:08 +02:00
|
|
|
import 'package:cw_core/transaction_direction.dart';
|
|
|
|
import 'package:cw_core/format_amount.dart';
|
|
|
|
|
|
|
|
class MoneroTransactionInfo extends TransactionInfo {
|
2024-07-21 03:46:43 +03:00
|
|
|
MoneroTransactionInfo(this.txHash, this.height, this.direction, this.date,
|
2023-02-08 18:47:12 +02:00
|
|
|
this.isPending, this.amount, this.accountIndex, this.addressIndex, this.fee,
|
2024-07-19 21:26:15 +02:00
|
|
|
this.confirmations) :
|
2024-07-21 03:46:43 +03:00
|
|
|
id = "${txHash}_${amount}_${accountIndex}_${addressIndex}";
|
2021-12-24 14:52:08 +02:00
|
|
|
|
|
|
|
final String id;
|
2024-07-21 03:46:43 +03:00
|
|
|
final String txHash;
|
2021-12-24 14:52:08 +02:00
|
|
|
final int height;
|
|
|
|
final TransactionDirection direction;
|
|
|
|
final DateTime date;
|
|
|
|
final int accountIndex;
|
|
|
|
final bool isPending;
|
|
|
|
final int amount;
|
|
|
|
final int fee;
|
|
|
|
final int addressIndex;
|
2023-02-08 18:47:12 +02:00
|
|
|
final int confirmations;
|
2022-10-12 13:09:57 -04:00
|
|
|
String? recipientAddress;
|
|
|
|
String? key;
|
|
|
|
String? _fiatAmount;
|
2021-12-24 14:52:08 +02:00
|
|
|
|
|
|
|
@override
|
|
|
|
String amountFormatted() =>
|
|
|
|
'${formatAmount(moneroAmountToString(amount: amount))} XMR';
|
|
|
|
|
|
|
|
@override
|
|
|
|
String fiatAmount() => _fiatAmount ?? '';
|
|
|
|
|
|
|
|
@override
|
|
|
|
void changeFiatAmount(String amount) => _fiatAmount = formatAmount(amount);
|
|
|
|
|
|
|
|
@override
|
|
|
|
String feeFormatted() =>
|
|
|
|
'${formatAmount(moneroAmountToString(amount: fee))} XMR';
|
|
|
|
}
|