implemented backend wallets/ledger accounts listing
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user