stack_wallet/lib/models/exchange/response_objects/trade.dart

172 lines
4.1 KiB
Dart
Raw Normal View History

2022-10-02 19:37:11 +00:00
import 'package:hive/hive.dart';
@HiveType(typeId: Trade.typeId)
class Trade {
static const typeId = 22;
@HiveField(0)
final String uuid;
@HiveField(1)
final String tradeId;
@HiveField(2)
final String rateType;
@HiveField(3)
final String direction;
@HiveField(4)
final DateTime timestamp;
@HiveField(5)
final DateTime updatedAt;
@HiveField(6)
final String payInCurrency;
2022-10-02 19:37:11 +00:00
@HiveField(7)
final String payInAmount;
2022-10-02 19:37:11 +00:00
@HiveField(8)
final String payInAddress;
2022-10-02 19:37:11 +00:00
@HiveField(9)
final String payInNetwork;
2022-10-02 19:37:11 +00:00
@HiveField(10)
final String payInExtraId;
2022-10-02 19:37:11 +00:00
@HiveField(11)
final String payInTxid;
2022-10-02 19:37:11 +00:00
@HiveField(12)
final String payOutCurrency;
2022-10-02 19:37:11 +00:00
@HiveField(13)
final String payOutAmount;
2022-10-02 19:37:11 +00:00
@HiveField(14)
final String payOutAddress;
2022-10-02 19:37:11 +00:00
@HiveField(15)
final String payOutNetwork;
2022-10-02 19:37:11 +00:00
@HiveField(16)
final String payOutExtraId;
2022-10-02 19:37:11 +00:00
@HiveField(17)
final String payOutTxid;
2022-10-02 19:37:11 +00:00
@HiveField(18)
final String refundAddress;
@HiveField(19)
final String refundExtraId;
@HiveField(20)
final String status;
const Trade({
required this.uuid,
required this.tradeId,
required this.rateType,
required this.direction,
required this.timestamp,
required this.updatedAt,
required this.payInCurrency,
required this.payInAmount,
required this.payInAddress,
required this.payInNetwork,
required this.payInExtraId,
required this.payInTxid,
required this.payOutCurrency,
required this.payOutAmount,
required this.payOutAddress,
required this.payOutNetwork,
required this.payOutExtraId,
required this.payOutTxid,
2022-10-02 19:37:11 +00:00
required this.refundAddress,
required this.refundExtraId,
required this.status,
});
Trade copyWith({
String? tradeId,
String? rateType,
String? direction,
DateTime? timestamp,
DateTime? updatedAt,
String? payInCurrency,
String? payInAmount,
String? payInAddress,
String? payInNetwork,
String? payInExtraId,
String? payInTxid,
String? payOutCurrency,
String? payOutAmount,
String? payOutAddress,
String? payOutNetwork,
String? payOutExtraId,
String? payOutTxid,
2022-10-02 19:37:11 +00:00
String? refundAddress,
String? refundExtraId,
String? status,
}) {
return Trade(
uuid: uuid,
2022-10-02 19:37:11 +00:00
tradeId: tradeId ?? this.tradeId,
rateType: rateType ?? this.rateType,
direction: direction ?? this.direction,
timestamp: timestamp ?? this.timestamp,
updatedAt: updatedAt ?? this.updatedAt,
payInCurrency: payInCurrency ?? this.payInCurrency,
payInAmount: payInAmount ?? this.payInAmount,
payInAddress: payInAddress ?? this.payInAddress,
payInNetwork: payInNetwork ?? this.payInNetwork,
payInExtraId: payInExtraId ?? this.payInExtraId,
payInTxid: payInTxid ?? this.payInTxid,
payOutCurrency: payOutCurrency ?? this.payOutCurrency,
payOutAmount: payOutAmount ?? this.payOutAmount,
payOutAddress: payOutAddress ?? this.payOutAddress,
payOutNetwork: payOutNetwork ?? this.payOutNetwork,
payOutExtraId: payOutExtraId ?? this.payOutExtraId,
payOutTxid: payOutTxid ?? this.payOutTxid,
2022-10-02 19:37:11 +00:00
refundAddress: refundAddress ?? this.refundAddress,
refundExtraId: refundExtraId ?? this.refundExtraId,
status: status ?? this.status,
);
}
2022-10-02 20:02:10 +00:00
Map<String, dynamic> toMap() {
return {
"uuid": uuid,
"tradeId": tradeId,
"rateType": rateType,
"direction": direction,
"timestamp": timestamp,
"updatedAt": updatedAt,
"payInCurrency": payInCurrency,
"payInAmount": payInAmount,
"payInAddress": payInAddress,
"payInNetwork": payInNetwork,
"payInExtraId": payInExtraId,
"payInTxid": payInTxid,
"payOutCurrency": payOutCurrency,
"payOutAmount": payOutAmount,
"payOutAddress": payOutAddress,
"payOutNetwork": payOutNetwork,
"payOutExtraId": payOutExtraId,
"payOutTxid": payOutTxid,
"refundAddress": refundAddress,
"refundExtraId": refundExtraId,
"status": status,
2022-10-02 20:02:10 +00:00
};
}
@override
String toString() {
return toMap().toString();
}
2022-10-02 19:37:11 +00:00
}