implemented backend wallets/ledger accounts listing

This commit is contained in:
Stephan D
2025-11-25 23:38:10 +01:00
parent be913bf96c
commit 68f0a1048f
25 changed files with 882 additions and 131 deletions

View File

@@ -4,11 +4,7 @@ import 'package:pweb/models/wallet.dart';
abstract class WalletsService {
Future<List<Wallet>> getWallets();
Future<List<Wallet>> updateWallet();
Future<List<Wallet>> createWallet();
Future<List<Wallet>> deleteWallet();
Future<Wallet> getWallet(String walletRef);
Future<double> getBalance(String walletRef);
}
class MockWalletsService implements WalletsService {
@@ -31,11 +27,11 @@ class MockWalletsService implements WalletsService {
}
@override
Future<List<Wallet>> updateWallet() async => [];
@override
Future<List<Wallet>> createWallet() async => [];
@override
Future<List<Wallet>> deleteWallet() async => [];
}
Future<double> getBalance(String walletRef) async {
final wallet = _wallets.firstWhere(
(w) => w.id == walletRef,
orElse: () => throw Exception('Wallet not found'),
);
return wallet.balance;
}
}