2021-07-08 14:52:48 +00:00
|
|
|
import 'package:cake_wallet/entities/wallet_info.dart';
|
|
|
|
|
|
|
|
abstract class WalletAddresses {
|
|
|
|
WalletAddresses(this.walletInfo) {
|
2021-07-13 05:46:34 +00:00
|
|
|
addressesMap = {};
|
2021-07-08 14:52:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
final WalletInfo walletInfo;
|
|
|
|
|
2021-07-13 05:46:34 +00:00
|
|
|
String get address;
|
2021-07-08 14:52:48 +00:00
|
|
|
|
2021-07-13 05:46:34 +00:00
|
|
|
set address(String address);
|
2021-07-08 14:52:48 +00:00
|
|
|
|
2021-07-13 05:46:34 +00:00
|
|
|
Map<String, String> addressesMap;
|
|
|
|
|
|
|
|
Future<void> init();
|
|
|
|
|
|
|
|
Future<void> updateAddressesInBox();
|
|
|
|
|
|
|
|
Future<void> saveAddressesInBox() async {
|
2021-07-08 14:52:48 +00:00
|
|
|
try {
|
|
|
|
if (walletInfo == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-07-13 05:46:34 +00:00
|
|
|
walletInfo.address = address;
|
|
|
|
walletInfo.addresses = addressesMap;
|
2021-07-08 14:52:48 +00:00
|
|
|
|
|
|
|
if (walletInfo.isInBox) {
|
|
|
|
await walletInfo.save();
|
|
|
|
}
|
|
|
|
} catch (e) {
|
|
|
|
print(e.toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|