cake_wallet/cw_ethereum/lib/ethereum_wallet_addresses.dart

34 lines
810 B
Dart
Raw Normal View History

2023-01-03 20:19:02 +00:00
import 'package:cw_core/wallet_addresses.dart';
import 'package:cw_core/wallet_info.dart';
import 'package:mobx/mobx.dart';
part 'ethereum_wallet_addresses.g.dart';
class EthereumWalletAddresses = EthereumWalletAddressesBase with _$EthereumWalletAddresses;
abstract class EthereumWalletAddressesBase extends WalletAddresses with Store {
EthereumWalletAddressesBase(WalletInfo walletInfo)
: address = '',
super(walletInfo);
@override
String address;
@override
2023-03-31 18:41:56 +00:00
Future<void> init() async {
address = walletInfo.address;
await updateAddressesInBox();
2023-01-03 20:19:02 +00:00
}
@override
2023-03-31 18:41:56 +00:00
Future<void> updateAddressesInBox() async {
try {
addressesMap.clear();
addressesMap[address] = '';
await saveAddressesInBox();
} catch (e) {
print(e.toString());
}
2023-01-03 20:19:02 +00:00
}
}