Fixed compilation

This commit is contained in:
Stephan D
2026-01-22 14:15:14 +01:00
parent 8456263dd8
commit 32e8376700
41 changed files with 549 additions and 190 deletions

View File

@@ -1,4 +1,5 @@
import 'package:pshared/models/describable.dart';
import 'package:pshared/models/ledger/balance.dart';
class LedgerAccount implements Describable {
@@ -15,6 +16,7 @@ class LedgerAccount implements Describable {
final DateTime? createdAt;
final DateTime? updatedAt;
final Describable describable;
final LedgerBalance? balance;
@override
String get name => describable.name;
@@ -36,6 +38,7 @@ class LedgerAccount implements Describable {
this.createdAt,
this.updatedAt,
required this.describable,
this.balance,
});
LedgerAccount copyWith({
@@ -54,5 +57,6 @@ class LedgerAccount implements Describable {
createdAt: createdAt,
updatedAt: updatedAt,
describable: describable ?? this.describable,
balance: balance,
);
}

View File

@@ -0,0 +1,16 @@
import 'package:pshared/models/money.dart';
class LedgerBalance {
final String ledgerAccountRef;
final Money? balance;
final int version;
final DateTime? lastUpdated;
const LedgerBalance({
required this.ledgerAccountRef,
this.balance,
required this.version,
this.lastUpdated,
});
}

View File

@@ -8,7 +8,6 @@ class Wallet implements Describable {
final String walletUserID; // ID or number that we show the user
final double balance;
final Currency currency;
final bool isHidden;
final DateTime calculatedAt;
final String? depositAddress;
final ChainNetwork? network;
@@ -29,7 +28,6 @@ class Wallet implements Describable {
required this.currency,
required this.calculatedAt,
required this.describable,
this.isHidden = true,
this.depositAddress,
this.network,
this.tokenSymbol,
@@ -37,32 +35,18 @@ class Wallet implements Describable {
});
Wallet copyWith({
String? id,
double? balance,
Currency? currency,
String? walletUserID,
bool? isHidden,
String? depositAddress,
ChainNetwork? network,
String? tokenSymbol,
String? contractAddress,
Describable? describable,
String? name,
String? Function()? description,
double? balance,
}) => Wallet(
id: id ?? this.id,
id: id,
balance: balance ?? this.balance,
currency: currency ?? this.currency,
walletUserID: walletUserID ?? this.walletUserID,
isHidden: isHidden ?? this.isHidden,
currency: currency,
walletUserID: walletUserID,
calculatedAt: calculatedAt,
depositAddress: depositAddress ?? this.depositAddress,
network: network ?? this.network,
tokenSymbol: tokenSymbol ?? this.tokenSymbol,
contractAddress: contractAddress ?? this.contractAddress,
describable: describable
?? (name != null || description != null
? this.describable.copyWith(name: name, description: description)
: this.describable),
depositAddress: depositAddress,
network: network,
tokenSymbol: tokenSymbol,
contractAddress: contractAddress,
describable: describable ?? this.describable,
);
}