Cw 498 improve wallet accounts (#1152)

* CW-498 Call updateTransactions on account change

* CW-498 Code Cleanup

* CW-498 Add Wallet Address to trade to match transactions to trades

* CW-498 Fix containsAddress to include only addresses of account

* Handle nullability for fromWalletAddress

---------

Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
This commit is contained in:
Konstantin Ullrich
2023-11-02 17:52:47 +02:00
committed by GitHub
co-authored by OmarHatem
parent 5bd382f186
commit e5d99313eb
13 changed files with 206 additions and 230 deletions
+9 -2
View File
@@ -27,6 +27,7 @@ class Trade extends HiveObject {
this.password,
this.providerId,
this.providerName,
this.fromWalletAddress
}) {
if (provider != null) providerRaw = provider.raw;
@@ -101,6 +102,9 @@ class Trade extends HiveObject {
@HiveField(16)
String? providerName;
@HiveField(17)
String? fromWalletAddress;
static Trade fromMap(Map<String, Object?> map) {
return Trade(
id: map['id'] as String,
@@ -110,7 +114,9 @@ class Trade extends HiveObject {
createdAt:
map['date'] != null ? DateTime.fromMillisecondsSinceEpoch(map['date'] as int) : null,
amount: map['amount'] as String,
walletId: map['wallet_id'] as String);
walletId: map['wallet_id'] as String,
fromWalletAddress: map['from_wallet_address'] as String?
);
}
Map<String, dynamic> toMap() {
@@ -121,7 +127,8 @@ class Trade extends HiveObject {
'output': to.serialize(),
'date': createdAt != null ? createdAt!.millisecondsSinceEpoch : null,
'amount': amount,
'wallet_id': walletId
'wallet_id': walletId,
'from_wallet_address': fromWalletAddress
};
}