WIP: Epic transaction data class

This commit is contained in:
Likho 2023-10-03 16:35:13 +02:00
parent 540c8b5c5d
commit e28c7f5019

View file

@ -3,8 +3,6 @@ import 'package:stackwallet/models/isar/models/isar_models.dart';
class EpicTransaction { class EpicTransaction {
Id isarId = Isar.autoIncrement;
@Index() @Index()
late final String walletId; late final String walletId;
@ -38,7 +36,6 @@ class EpicTransaction {
final address = IsarLink<Address>(); final address = IsarLink<Address>();
EpicTransaction({ EpicTransaction({
required this.walletId,
required this.parentKeyId, required this.parentKeyId,
required this.id, required this.id,
this.txSlateId, this.txSlateId,
@ -59,28 +56,28 @@ class EpicTransaction {
this.paymentProof, this.paymentProof,
}); });
// factory EpicTransaction.fromJson(Map<String, dynamic> json) { factory EpicTransaction.fromJson(Map<String, dynamic> json) {
// return EpicTransaction( return EpicTransaction(
// parentKeyId: json['parent_key_id'] as String, parentKeyId: json['parent_key_id'] as String,
// id: json['id'] as int, id: json['id'] as int,
// txSlateId: json['tx_slate_id'] as String, txSlateId: json['tx_slate_id'] as String,
// txType: json['tx_type'] as TransactionType, txType: json['tx_type'] as TransactionType,
// creationTs: json['creation_ts'] as String, creationTs: json['creation_ts'] as String,
// confirmationTs: json['confirmation_ts'] as String, confirmationTs: json['confirmation_ts'] as String,
// confirmed: json['confirmed'] as bool, confirmed: json['confirmed'] as bool,
// numInputs: json['num_inputs'] as int, numInputs: json['num_inputs'] as int,
// numOutputs: json['num_outputs'] as int, numOutputs: json['num_outputs'] as int,
// amountCredited: json['amount_credited'] as String, amountCredited: json['amount_credited'] as String,
// amountDebited: json['amount_debited'] as String, amountDebited: json['amount_debited'] as String,
// fee: json['fee'] as String, fee: json['fee'] as String,
// ttlCutoffHeight: json['ttl_cutoff_height'] as String, ttlCutoffHeight: json['ttl_cutoff_height'] as String,
// messages: json['messages'] != null ? Messages.fromJson(json['messages'] as Map<String, dynamic>) : null, messages: json['messages'] != null ? Messages.fromJson(json['messages'] as Map<String, dynamic>) : null,
// storedTx: json['stored_tx'] as String, storedTx: json['stored_tx'] as String,
// kernelExcess: json['kernel_excess'] as String, kernelExcess: json['kernel_excess'] as String,
// kernelLookupMinHeight: json['kernel_lookup_min_height'] as int, kernelLookupMinHeight: json['kernel_lookup_min_height'] as int,
// paymentProof: json['payment_proof'] as String, paymentProof: json['payment_proof'] as String,
// ); );
// } }
} }
class Messages { class Messages {
@ -118,10 +115,9 @@ class Message {
} }
} }
// Used in Isar db and stored there as int indexes so adding/removing values
// in this definition should be done extremely carefully in production enum EpicTransactionType {
enum TransactionType { //Use Epic transaction type here
// TODO: add more types before prod release?
outgoing, outgoing,
incoming, incoming,
sentToSelf, // should we keep this? sentToSelf, // should we keep this?