mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-01 18:07:44 +00:00
30 lines
647 B
Dart
30 lines
647 B
Dart
|
import 'package:cake_wallet/entities/wallet_addresses_credentials.dart';
|
||
|
import 'package:cake_wallet/entities/wallet_info.dart';
|
||
|
|
||
|
abstract class WalletAddresses {
|
||
|
WalletAddresses(this.walletInfo) {
|
||
|
addresses = walletInfo?.addresses ?? {};
|
||
|
}
|
||
|
|
||
|
final WalletInfo walletInfo;
|
||
|
|
||
|
Map<String, String> addresses;
|
||
|
|
||
|
Future<void> update(WalletAddressesCredentials credentials);
|
||
|
|
||
|
Future<void> save() async {
|
||
|
try {
|
||
|
if (walletInfo == null) {
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
walletInfo.addresses = addresses;
|
||
|
|
||
|
if (walletInfo.isInBox) {
|
||
|
await walletInfo.save();
|
||
|
}
|
||
|
} catch (e) {
|
||
|
print(e.toString());
|
||
|
}
|
||
|
}
|
||
|
}
|