mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-11-25 11:03:55 +01:00
Upstream reformatted its whole tree in 16ddc0837. Matching it removes
formatting from the conflict surface of this and every later sync.
40 lines
1.0 KiB
Dart
40 lines
1.0 KiB
Dart
class NanoTransactionModel {
|
|
final DateTime? date;
|
|
final String hash;
|
|
final bool confirmed;
|
|
final String account;
|
|
final BigInt amount;
|
|
final int height;
|
|
final String type;
|
|
|
|
NanoTransactionModel({
|
|
this.date,
|
|
required this.hash,
|
|
required this.height,
|
|
required this.amount,
|
|
required this.confirmed,
|
|
required this.type,
|
|
required this.account,
|
|
});
|
|
|
|
factory NanoTransactionModel.fromJson(dynamic json) {
|
|
DateTime? localTimestamp;
|
|
try {
|
|
localTimestamp =
|
|
DateTime.fromMillisecondsSinceEpoch(int.parse(json["local_timestamp"] as String) * 1000);
|
|
} catch (e) {
|
|
localTimestamp = DateTime.now();
|
|
}
|
|
|
|
return NanoTransactionModel(
|
|
date: localTimestamp,
|
|
hash: json["hash"] as String,
|
|
height: int.parse(json["height"] as String),
|
|
type: json["type"] as String,
|
|
amount: BigInt.parse(json["amount"] as String),
|
|
account: json["account"] as String,
|
|
confirmed: (json["confirmed"] as String) == "true",
|
|
);
|
|
}
|
|
}
|